for posts and comments add_theme_support( 'automatic-feed-links' ); // Let WordPress manage the document title. add_theme_support( 'title-tag' ); // Enable support for custom logo. add_theme_support( 'custom-logo', array( 'height' => '360', 'width' => '900', 'flex-width' => true, 'flex-height' => true, ) ); // Enable support for Post Thumbnails on posts and pages. add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 1125, 9999 ); // Register additional image sizes. add_image_size( 'bloggo-nav', 360, 9999 ); // This theme uses wp_nav_menu() in two locations. register_nav_menus( array( 'primary' => esc_html__( 'Primary Menu', 'bloggo' ), 'footer_social' => esc_html__( 'Footer Social Links', 'bloggo' ) ) ); /* * 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 the visual editor to resemble the theme style. add_editor_style( array( 'css/editor-style.css', bloggo_fonts_url() ) ); // Add theme support for selective refresh for widgets. add_theme_support( 'customize-selective-refresh-widgets' ); } endif; add_action( 'after_setup_theme', 'bloggo_setup' ); /** * Set the content width in pixels, based on the theme's design and stylesheet. */ function bloggo_content_width() { $GLOBALS['content_width'] = apply_filters( 'bloggo_content_width', 900 ); } add_action( 'after_setup_theme', 'bloggo_content_width', 0 ); /** * Register a widget area. */ function bloggo_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Sidebar', 'bloggo' ), 'id' => 'sidebar-1', 'description' => esc_html__( 'Appears on the right side of the site.', 'bloggo' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' ) ); } add_action( 'widgets_init', 'bloggo_widgets_init' ); if ( ! function_exists( 'bloggo_fonts_url' ) ) : /** * Register Google fonts for Bloggo. */ function bloggo_fonts_url() { $fonts_url = ''; $fonts = array(); /* 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. */ if ( 'off' !== esc_html_x( 'on', 'Lato font: on or off', 'bloggo' ) ) $fonts[] = 'Lato:400,400italic,700,700italic'; if ( $fonts ) { $fonts_url = add_query_arg( array( 'family' => urlencode( implode( '|', $fonts ) ), 'subset' => urlencode( 'latin,latin-ext' ), ), '//fonts.googleapis.com/css' ); } return $fonts_url; } endif; /** * Add preconnect for Google Fonts. */ function bloggo_resource_hints( $urls, $relation_type ) { if ( wp_style_is( 'bloggo-fonts', 'queue' ) && 'preconnect' === $relation_type ) { $urls[] = array( 'href' => 'https://fonts.gstatic.com', 'crossorigin', ); } return $urls; } add_filter( 'wp_resource_hints', 'bloggo_resource_hints', 10, 2 ); /** * Enqueue scripts and styles. */ function bloggo_scripts() { // Add custom fonts, used in the main stylesheet. wp_enqueue_style( 'bloggo-fonts', bloggo_fonts_url(), array(), null ); // Theme stylesheet. wp_enqueue_style( 'bloggo-style', get_stylesheet_uri() ); // Add JavaScript to support threaded comments (when in use). if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) wp_enqueue_script( 'comment-reply' ); // Add custom scripts. wp_enqueue_script( 'jquery-fitvids', get_template_directory_uri() . '/js/jquery.fitvids.min.js', array( 'jquery' ), '20180414', true ); wp_enqueue_script( 'bloggo-script-jquery', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20180414', true ); wp_localize_script( 'bloggo-script-jquery', 'bloggoVars', array( 'screenReaderText' => esc_html__( 'child menu', 'bloggo' ), ) ); } add_action( 'wp_enqueue_scripts', 'bloggo_scripts' ); /** * Add custom classes to the array of body classes. */ function bloggo_body_classes( $classes ) { // Add a class of hfeed to non-singular pages. if ( ! is_singular() ) $classes[] = 'hfeed'; if ( get_theme_mod( 'bloggo_content_fadein' ) ) $classes[] = 'fade-in-down'; // Add a class of no-avatars if avatars are disabled in discussion settings. if ( ! get_option( 'show_avatars' ) ) $classes[] = 'no-avatars'; return $classes; } add_filter( 'body_class', 'bloggo_body_classes' ); /** * Customize the archive title. */ function bloggo_archive_title( $title ) { if ( is_category() ) { $title = sprintf( esc_html__( 'All posts in %s', 'bloggo' ), '' . single_cat_title( '', false ) . '' ); } elseif ( is_tag() ) { $title = sprintf( esc_html__( 'All posts tagged %s', 'bloggo' ), '' . single_tag_title( '', false ) . '' ); } elseif ( is_author() ) { $title = sprintf( esc_html__( 'All posts by %s', 'bloggo' ), '' . get_the_author() . '' ); } elseif ( is_year() ) { $title = sprintf( esc_html__( 'All posts in %s', 'bloggo' ), '' . get_the_date( esc_html_x( 'Y', 'yearly archives date format', 'bloggo' ) ) . '' ); } elseif ( is_month() ) { $title = sprintf( esc_html__( 'All posts in %s', 'bloggo' ), '' . get_the_date( esc_html_x( 'F Y', 'monthly archives date format', 'bloggo' ) ) . '' ); } elseif ( is_day() ) { $title = sprintf( esc_html__( 'All posts dated %s', 'bloggo' ), '' . get_the_date( esc_html_x( 'F j, Y', 'daily archives date format', 'bloggo' ) ) . '' ); } return $title; } add_filter( 'get_the_archive_title', 'bloggo_archive_title' ); /** * Modify tag cloud widget arguments to have all tags in the widget same font size. */ function bloggo_custom_tag_cloud_widget( $args ) { $args['smallest'] = 10; $args['largest'] = 10; $args['unit'] = 'px'; return $args; } add_filter( 'widget_tag_cloud_args', 'bloggo_custom_tag_cloud_widget' ); /** * Custom template tags for the theme. */ require get_template_directory() . '/inc/template-tags.php'; /** * Customizer additions. */ require get_template_directory() . '/inc/customize.php'; require get_template_directory() . '/inc/customize-css.php'; /* * Load Jetpack compatibility file. */ require get_template_directory() . '/inc/jetpack.php';