__( 'Primary Menu', 'hemingway-rewritten' ), ) ); // Enable support for Post Formats. add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link' ) ); // Setup the WordPress core custom background feature. add_theme_support( 'custom-background', apply_filters( 'hemingway_rewritten_custom_background_args', array( 'default-color' => 'ffffff', ) ) ); // Enable support for HTML5 markup. add_theme_support( 'html5', array( 'comment-list', 'search-form', 'comment-form', ) ); // Enable support for Editor Styles. add_editor_style( array( 'editor-style.css', hemingway_rewritten_google_fonts() ) ); } endif; // hemingway_rewritten_setup add_action( 'after_setup_theme', 'hemingway_rewritten_setup' ); /** * Register widgetized area and update sidebar with default widgets. */ function hemingway_rewritten_widgets_init() { register_sidebar( array( 'name' => __( 'Sidebar', 'hemingway-rewritten' ), 'id' => 'sidebar-1', 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer 1', 'hemingway-rewritten' ), 'id' => 'sidebar-2', 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer 2', 'hemingway-rewritten' ), 'id' => 'sidebar-3', 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer 3', 'hemingway-rewritten' ), 'id' => 'sidebar-4', 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'hemingway_rewritten_widgets_init' ); /** * Enqueue scripts and styles. */ function hemingway_rewritten_scripts() { wp_enqueue_style( 'hemingway-rewritten-fonts', hemingway_rewritten_google_fonts(), array(), null ); wp_enqueue_style( 'hemingway-rewritten-style', get_stylesheet_uri() ); wp_enqueue_style( 'genericons', get_template_directory_uri() . '/genericons/genericons.css' ); wp_enqueue_script( 'hemingway-rewritten-script', get_template_directory_uri() . '/js/hemingway-rewritten.js', array(), '20230511', true ); wp_enqueue_script( 'hemingway-rewritten-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20120206', true ); wp_enqueue_script( 'hemingway-rewritten-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20130115', true ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } add_action( 'wp_enqueue_scripts', 'hemingway_rewritten_scripts' ); /** * Return Google Fonts URL */ function hemingway_rewritten_google_fonts() { $fonts_url = ''; /* Translators: If there are characters in your language that are not supported by Raleway, * translate this to 'off'. Do not translate into your own language. */ $raleway = _x( 'on', 'Raleway font: on or off', 'hemingway-rewritten' ); /* Translators: If there are characters in your language that are not supported by Lato, * translate this to 'off'. Do not translate into your own language. */ $lato = _x( 'on', 'Lato font: on or off', 'hemingway-rewritten' ); if ( 'off' !== $raleway || 'off' !== $lato ) { $font_families = array(); if ( 'off' !== $raleway ) { $font_families[] = 'Raleway:400,300,700'; } if ( 'off' !== $lato ) { $font_families[] = 'Lato:400,700,400italic,700italic'; } $query_args = array( 'family' => urlencode( implode( '|', $font_families ) ), 'subset' => urlencode( 'latin,latin-ext' ), ); $fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' ); } return esc_url_raw( $fonts_url ); } /** * Enqueue Google Fonts for custom headers */ function hemingway_rewritten_admin_scripts( $hook_suffix ) { if ( 'appearance_page_custom-header' != $hook_suffix ) { return; } wp_enqueue_style( 'hemingway-rewritten-fonts', hemingway_rewritten_google_fonts(), array(), null ); } add_action( 'admin_enqueue_scripts', 'hemingway_rewritten_admin_scripts' ); /** * If a page or post has a featured image set, use that instead of the custom header */ function hemingway_rewritten_featured_image_headers() { global $post; if ( ( ! hemingway_rewritten_jetpack_featured_image_display() ) || is_archive() || is_search() || is_home() ) { return; } if ( is_page() && has_post_thumbnail() ) { $image = wp_get_attachment_image_src( get_post_thumbnail_id(), 'hemingway-rewritten-header' ); $image = $image[0]; } elseif ( is_single() && hemingway_rewritten_has_post_thumbnail() ) { $image = hemingway_rewritten_get_attachment_image_src( $post->ID, get_post_thumbnail_id( $post->ID ), 'hemingway-rewritten-header' ); } else { return; } ?>