tag in the document head, and expect WordPress to * provide it for us. */ add_theme_support( 'title-tag' ); /* * 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' ); //we need this size so we can make the responsive images work better add_image_size( 'jasonlite-max-image', 1440, 9999, false ); /* * Add theme support for site logo * * First, it's the image size we want to use for the logo thumbnails * Second, the 2 classes we want to use for the "Display Header Text" Customizer logic */ add_theme_support( 'custom-logo', apply_filters( 'jasonlite_header_site_logo', array( 'height' => 600, 'width' => 1360, 'flex-height' => true, 'flex-width' => true, 'header-text' => array( 'site-title', 'site-description-text', ) ) ) ); // This theme uses wp_nav_menu() in three locations. register_nav_menus( array( 'primary' => esc_html__( 'Primary Menu', 'jason-lite' ), 'footer' => esc_html__( 'Footer Menu', 'jason-lite' ), 'social' => esc_html__( 'Social Menu', 'jason-lite' ), ) ); /* * 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', ) ); /* * Add editor custom style to make it look more like the frontend * Also enqueue the custom Google Fonts and self-hosted ones */ add_editor_style( array( 'editor-style.css', jasonlite_google_fonts_url(), jasonlite_libre_caslon_text_font_url() ) ); /* * Enable support for Visible Edit Shortcuts in the Customizer Preview * * @link https://make.wordpress.org/core/2016/11/10/visible-edit-shortcuts-in-the-customizer-preview/ */ add_theme_support( 'customize-selective-refresh-widgets' ); /** * Enable support for the Style Manager Customizer section (via Customify). */ add_theme_support( 'customizer_style_manager' ); } endif; // jason_setup add_action( 'after_setup_theme', 'jasonlite_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 jasonlite_content_width() { $GLOBALS['content_width'] = apply_filters( 'jasonlite_content_width', 1050, 0 ); } add_action( 'after_setup_theme', 'jasonlite_content_width', 0 ); /** * Set the gallery widget width in pixels, based on the theme's design and stylesheet. */ function jasonlite_gallery_widget_width( $args, $instance ) { return '1050'; } add_filter( 'gallery_widget_content_width', 'jasonlite_gallery_widget_width', 10, 3 ); /** * Add custom image sizes attribute to enhance responsive image functionality * for content images * * @since Jason 1.2.0 * * @param string $sizes A source size value for use in a 'sizes' attribute. * @param array $size Image size. Accepts an array of width and height * values in pixels (in that order). * @return string A source size value for use in a content image 'sizes' attribute. */ function jasonlite_content_image_sizes_attr( $sizes, $size ) { $width = $size[0]; if ( is_active_sidebar( 'sidebar-1' ) ) { 1070 <= $width && $sizes = '(max-width: 899px) 100vw, (max-width: 1099px) 70vw, (max-width: 1509px) 67vw, 1070px'; 1070 > $width && $width >= 899 && $sizes = '(max-width: 899px) 100vw, (max-width: ' . $width . 'px) 70vw,' . $width . 'px'; 899 > $width && $sizes = '(max-width: ' . $width .'px) 100vw, ' . $width . 'px'; } else { 1440 <= $width && $sizes = '(max-width: 1440px) 100vw, 1440px'; 1440 > $width && $sizes = '(max-width: ' . $width .'px) 100vw, ' . $width . 'px'; } return $sizes; } add_filter( 'wp_calculate_image_sizes', 'jasonlite_content_image_sizes_attr', 10 , 2 ); /** * Register widget area. * * @link http://codex.wordpress.org/Function_Reference/register_sidebar */ function jasonlite_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Sidebar', 'jason-lite' ), 'id' => 'sidebar-1', 'description' => '', 'before_widget' => '', 'before_title' => '