'main', 'render' => 'afterlight_2_infinite_scroll_render', 'footer' => 'page', ) ); // Add support for Content Options add_theme_support( 'jetpack-content-options', array( 'blog-display' => array( 'content', 'excerpt' ), // the default setting of the theme: 'content', 'excerpt' or array( 'content', 'excerpt' ) for themes mixing both display. 'author-bio' => true, // display or not the author bio: true or false. 'author-bio-default' => false, // the default setting of the author bio, if it's being displayed or not: true or false (only required if false). 'post-details' => array( 'stylesheet' => 'afterlight-2-style', // name of the theme's stylesheet. 'date' => '.posted-on', // a CSS selector matching the elements that display the post date. 'categories' => '.cat-links', // a CSS selector matching the elements that display the post categories. 'tags' => '.tags-links', // a CSS selector matching the elements that display the post tags. 'author' => '.byline', // a CSS selector matching the elements that display the post author. 'comment' => '.comments-link', // a CSS selector matching the elements that display the comment link. ), 'featured-images' => array( 'archive' => false, // enable or not the featured image check for archive pages: true or false. 'archive-default' => false, // the default setting of the featured image on archive pages, if it's being displayed or not: true or false (only required if false). 'post' => true, // enable or not the featured image check for single posts: true or false. 'post-default' => false, // the default setting of the featured image on single posts, if it's being displayed or not: true or false (only required if false). 'page' => false, // enable or not the featured image check for single pages: true or false. 'page-default' => false, // the default setting of the featured image on single pages, if it's being displayed or not: true or false (only required if false). ), ) ); // Add theme support for Responsive Videos. add_theme_support( 'jetpack-responsive-videos' ); // Add theme support for Social Menus add_theme_support( 'jetpack-social-menu', 'svg' ); } add_action( 'after_setup_theme', 'afterlight_2_jetpack_setup' ); /** * Custom render function for Infinite Scroll. */ function afterlight_2_infinite_scroll_render() { while ( have_posts() ) { the_post(); if ( is_search() ) : get_template_part( 'template-parts/content', 'search' ); else : get_template_part( 'template-parts/content', get_post_format() ); endif; } } /** * Custom function to check for a post thumbnail; * If Jetpack is not available, fall back to has_post_thumbnail() */ function afterlight_2_has_post_thumbnail( $post = null ) { if ( function_exists( 'jetpack_has_featured_image' ) ) { return jetpack_has_featured_image( $post ); } else { return has_post_thumbnail( $post ); } } /** * JetPack Social Menu Fallback */ function afterlight_2_social_menu() { if ( ! function_exists( 'jetpack_social_menu' ) ) { return; } else { jetpack_social_menu(); } } /** * Add theme support for Responsive Videos * * @since Afterlight 1.0 */ function afterlight_2_responsive_videos_init() { add_theme_support( 'jetpack-responsive-videos' ); } add_action( 'after_setup_theme', 'afterlight_2_responsive_videos_init' ); /** * Overwritte default gallery widget content width. * * @since Afterlight 1.0 */ function afterlight_2_gallery_widget_content_width( $width ) { return 704; } add_filter( 'gallery_widget_content_width', 'afterlight_2_gallery_widget_content_width'); /** * This function is triggered on the initialization of the Previewer in the Customizer. We add actions * that pertain to the Previewer window here. The actions added here are triggered only in * the Previewer and not in the Customizer. */ add_action( 'customize_preview_init', 'afterlight_2_customize_preview_init' ); function afterlight_2_customize_preview_init() { // Enqueue previewer scripts and styles add_action( 'wp_enqueue_scripts', 'afterlight_2_jetpack_customize_preview_js' ); } /** * This function is called only on the Previwer and enqueues scripts and styles. */ function afterlight_2_jetpack_customize_preview_js() { /* * Our Customizer script * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. * * Dependencies: Customizer Preview Widgets script (core) */ wp_enqueue_script( 'afterlight-2-jetpack-customizer', get_template_directory_uri() . '/assets/js/customizer-preview.js', array( 'customize-preview' ), '20170727', true ); /* * Here is where you'll want to localize your data for the script. "contentOptionsSettings" will be the variable * name used within the Previewer when the data is output. */ wp_localize_script( 'afterlight-2-jetpack-customizer-settings', 'contentOptionsSettings', array( 'blogDisplay' => get_option( 'jetpack_content_blog_display' ), ) ); }