tag in the document head, and expect WordPress to * provide it for us. */ add_theme_support( 'title-tag' ); add_editor_style( array( get_template_directory_uri() . '/editor-style.css', lovecraft_fonts_url() ) ); /* * Enable support for Post Thumbnails on posts and pages. * * @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails */ add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size ( 88, 88, true ); add_image_size( 'lovecraft-post-image', 900, 9999 ); add_image_size( 'lovecraft-post-image-cover', 1280, 9999 ); // This theme uses wp_nav_menu() in one location. register_nav_menus( array( 'primary' => esc_html__( 'Primary Menu', 'lovecraft' ), ) ); /* * Switch default core markup for search form, comment form, and comments * to output valid HTML5. */ add_theme_support( 'html5', array( 'comment-form', 'gallery', 'caption', ) ); /* * Enable support for Post Formats. * See http://codex.wordpress.org/Post_Formats */ add_theme_support( 'post-formats', array( 'aside', ) ); // Set up the WordPress core custom background feature. add_theme_support( 'custom-background', apply_filters( 'lovecraft_custom_background_args', array( 'default-color' => 'fafafa', 'default-image' => '', ) ) ); // Add support for responsive embeds. add_theme_support( 'responsive-embeds' ); } endif; // lovecraft_setup add_action( 'after_setup_theme', 'lovecraft_setup' ); /** * Set the content width in pixels, based on the theme's design and stylesheet. * * Priority 0 to make it available to lower priority callbacks. * * @global int $content_width */ function lovecraft_content_width() { $GLOBALS['content_width'] = apply_filters( 'lovecraft_content_width', 640 ); } add_action( 'after_setup_theme', 'lovecraft_content_width', 0 ); /** * Register widget area. * * @link http://codex.wordpress.org/Function_Reference/register_sidebar */ function lovecraft_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Sidebar', 'lovecraft' ), 'id' => 'sidebar-1', 'description' => '', 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer Widgets 1', 'lovecraft' ), 'id' => 'footer-1', 'description' => '', 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer Widgets 2', 'lovecraft' ), 'id' => 'footer-2', 'description' => '', 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer Widgets 3', 'lovecraft' ), 'id' => 'footer-3', 'description' => '', 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'lovecraft_widgets_init' ); /** * Enqueue scripts and styles. */ function lovecraft_scripts() { wp_enqueue_style( 'lovecraft-style', get_stylesheet_uri() ); wp_enqueue_style( 'lovecraft-fonts', lovecraft_fonts_url() ); wp_enqueue_style( 'genericons', get_template_directory_uri() . '/genericons/genericons.css', array(), '3.3' ); wp_enqueue_script( 'lovecraft-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20120206', true ); wp_enqueue_script( 'lovecraft-global', get_template_directory_uri().'/js/global.js', array(), '20230525', true ); wp_enqueue_script( 'lovecraft-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', 'lovecraft_scripts' ); /** * Register Google Fonts */ function lovecraft_fonts_url() { $fonts_url = ''; /* Translators: If there are characters in your language that are not * supported by Playfair Display, translate this to 'off'. Do not translate * into your own language. */ $playfair = esc_html_x( 'on', 'Playfair Display font: on or off', 'lovecraft' ); $lato = esc_html_x( 'on', 'Lato font: on or off', 'lovecraft' ); if ( 'off' !== $playfair || 'off' !== $lato ) { $font_families = array(); if ( 'off' !== $playfair ) { $font_families[] = 'Playfair Display:400,700,400italic'; } if ( 'off' !== $lato ) { $font_families[] = 'Lato:400,400italic,700,700italic,900,900italic'; } $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 $fonts_url; } /** * Enqueue Google Fonts for Editor Styles */ function lovecraft_editor_styles() { add_editor_style( array( 'editor-style.css', lovecraft_fonts_url() ) ); } add_action( 'after_setup_theme', 'lovecraft_editor_styles' ); /* * Custom comments display to move timestamp and Reply link, * used in comments.php */ function lovecraft_comments( $comment, $args, $depth ) { $GLOBALS['comment'] = $comment; switch ( $comment->comment_type ) : case 'pingback' : case 'trackback' : // Display trackbacks differently than normal comments. ?>
  • id="comment-">

    ', '' ); ?>

  • >
    %s', get_comment_author_link() ); ?>
    comment_approved ) : ?>