esc_html__( 'Primary Menu', 'stackwise' ), 'footer' => esc_html__( 'Footer Menu', 'stackwise' ), ) ); /* * Switch default core markup for search form, comment form, and comments * to output valid HTML5. */ add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption', 'style', 'script', ) ); // Set up the WordPress core custom background feature. add_theme_support( 'custom-background', apply_filters( 'stackwise_custom_background_args', array( 'default-color' => '0d1117', 'default-image' => '', ) ) ); // Add theme support for selective refresh for widgets. add_theme_support( 'customize-selective-refresh-widgets' ); // Add support for custom logo. add_theme_support( 'custom-logo', array( 'height' => 80, 'width' => 200, 'flex-width' => true, 'flex-height' => true, ) ); // Add support for Block Styles. add_theme_support( 'wp-block-styles' ); // Add support for full and wide align images. add_theme_support( 'align-wide' ); // Add support for editor styles. add_theme_support( 'editor-styles' ); // Enqueue editor styles. add_editor_style( 'assets/css/editor-style.css' ); // Add support for responsive embedded content. add_theme_support( 'responsive-embeds' ); // Add support for custom line height controls. add_theme_support( 'custom-line-height' ); // Add support for experimental link color control. add_theme_support( 'link-color' ); // Add support for custom units. add_theme_support( 'custom-units' ); // Add support for custom spacing. add_theme_support( 'custom-spacing' ); // Remove core block patterns. remove_theme_support( 'core-block-patterns' ); // Add support for appearance tools. add_theme_support( 'appearance-tools' ); // Add support for custom header image. add_theme_support( 'custom-header', apply_filters( 'stackwise_custom_header_args', array( 'default-image' => '', 'header-text' => false, 'width' => 1200, 'height' => 900, 'flex-height' => true, 'flex-width' => true, ) ) ); /** * Add support for Starter Content */ add_theme_support( 'starter-content', stackwise_get_starter_content() ); } add_action( 'after_setup_theme', 'stackwise_setup' ); /** * Set the content width in pixels, based on the theme's design and stylesheet. * * @global int $content_width */ function stackwise_content_width() { $GLOBALS['content_width'] = apply_filters( 'stackwise_content_width', 1200 ); } add_action( 'after_setup_theme', 'stackwise_content_width', 0 ); /** * Register widget area. */ function stackwise_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Footer Widget Area', 'stackwise' ), 'id' => 'footer-1', 'description' => esc_html__( 'Add footer widgets here.', 'stackwise' ), 'before_widget' => '
', 'before_title' => '' . esc_html( $text ) . '
'; }; return array( 'posts' => array( 'home' => array( 'post_type' => 'page', 'post_title' => _x( 'Home', 'Theme starter content', 'stackwise' ), 'post_content' => '', ), 'about' => array( 'post_type' => 'page', 'post_title' => _x( 'About Me', 'Theme starter content', 'stackwise' ), 'post_content' => $paragraph( _x( 'I am a developer who builds fast, accessible websites. Use this page to tell visitors who you are, what you work on and what you care about.', 'Theme starter content', 'stackwise' ) ) . $paragraph( _x( 'Add a featured image to this page to show a photo next to this text on the front page.', 'Theme starter content', 'stackwise' ) ), ), 'services' => array( 'post_type' => 'page', 'post_title' => _x( 'What I Do', 'Theme starter content', 'stackwise' ), 'post_content' => stackwise_pattern_skills_columns(), ), 'blog' => array( 'post_type' => 'page', 'post_title' => _x( 'Blog', 'Theme starter content', 'stackwise' ), ), 'contact' => array( 'post_type' => 'page', 'post_title' => _x( 'Contact', 'Theme starter content', 'stackwise' ), 'template' => 'template-contact.php', 'post_content' => $paragraph( _x( 'Have a project in mind or just want to say hello? Add a contact form block from your form plugin here, and set your email address and location in Appearance > Customize > Theme Options.', 'Theme starter content', 'stackwise' ) ), ), ), 'options' => array( 'show_on_front' => 'page', 'page_on_front' => '{{home}}', 'page_for_posts' => '{{blog}}', ), 'theme_mods' => array( 'stackwise_fp_about_page' => '{{about}}', 'stackwise_fp_services_page' => '{{services}}', 'stackwise_fp_contact_page' => '{{contact}}', ), 'widgets' => array( 'footer-1' => array( 'text_about', 'recent-posts', ), ), 'nav_menus' => array( 'primary' => array( 'name' => __( 'Primary Menu', 'stackwise' ), 'items' => array( 'link_home', 'link_about' => array( 'type' => 'custom', 'title' => _x( 'About', 'Theme starter content', 'stackwise' ), 'url' => home_url( '/#about' ), ), 'page_blog', 'link_contact' => array( 'type' => 'custom', 'title' => _x( 'Contact', 'Theme starter content', 'stackwise' ), 'url' => home_url( '/#contact' ), ), ), ), 'footer' => array( 'name' => __( 'Footer Menu', 'stackwise' ), 'items' => array( 'page_about' => array( 'type' => 'post_type', 'object' => 'page', 'object_id' => '{{about}}', ), 'page_blog', 'page_contact', ), ), ), ); } /** * Include additional files */ // Custom template tags. require STACKWISE_DIR . '/inc/template-tags.php'; // Template functions. require STACKWISE_DIR . '/inc/template-functions.php'; // Customizer additions. require STACKWISE_DIR . '/inc/customizer.php'; // Block patterns. require STACKWISE_DIR . '/inc/block-patterns.php'; /** * Add custom body classes * * @param array $classes Classes for the body element. * @return array */ function stackwise_body_classes( $classes ) { // Add a class if there is a custom header. if ( has_header_image() ) { $classes[] = 'has-header-image'; } // Add class for front page. if ( is_front_page() && ! is_home() ) { $classes[] = 'is-front-page'; } // Add class for singular views. if ( is_singular() ) { $classes[] = 'is-singular'; } return $classes; } add_filter( 'body_class', 'stackwise_body_classes' ); /** * Add a pingback url auto-discovery header for single posts, pages, or attachments. */ function stackwise_pingback_header() { if ( is_singular() && pings_open() ) { printf( '', esc_url( get_bloginfo( 'pingback_url' ) ) ); } } add_action( 'wp_head', 'stackwise_pingback_header' ); /** * Add preconnect for Google Fonts. * * @param array $urls URLs to print for resource hints. * @param string $relation_type The relation type the URLs are printed. * @return array URLs to print for resource hints. */ function stackwise_resource_hints( $urls, $relation_type ) { if ( 'preconnect' === $relation_type ) { $urls[] = array( 'href' => 'https://fonts.googleapis.com', ); $urls[] = array( 'href' => 'https://fonts.gstatic.com', 'crossorigin', ); } return $urls; } add_filter( 'wp_resource_hints', 'stackwise_resource_hints', 10, 2 ); /** * Modify excerpt length * * @param int $length Excerpt length. * @return int Modified excerpt length. */ function stackwise_excerpt_length( $length ) { if ( is_admin() ) { return $length; } return 20; } add_filter( 'excerpt_length', 'stackwise_excerpt_length' ); /** * Modify excerpt more string * * @param string $more More string. * @return string Modified more string. */ function stackwise_excerpt_more( $more ) { if ( is_admin() ) { return $more; } return '…'; } add_filter( 'excerpt_more', 'stackwise_excerpt_more' );