PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 13.0.2
Jetpack – WP Security, Backup, Speed, & Growth v13.0.2
12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 13.9.2 14.0.1 14.1.1 14.2.2 14.3.1 14.4.2 All 500 releases
jetpack / modules / infinite-scroll / themes / twentyseventeen.php
twentyseventeen.php
64 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Infinite Scroll Theme Assets
4 *
5 * Register support for Twenty Seventeen.
6 *
7 * @package jetpack
8 */
9
10 /**
11 * Add theme support for infinite scroll
12 */
13 function jetpack_twentyseventeen_infinite_scroll_init() {
14 add_theme_support(
15 'infinite-scroll',
16 array(
17 'container' => 'main',
18 'render' => 'jetpack_twentyseventeen_infinite_scroll_render',
19 'footer' => 'content',
20 'footer_widgets' => jetpack_twentyseventeen_has_footer_widgets(),
21 )
22 );
23 }
24 add_action( 'init', 'jetpack_twentyseventeen_infinite_scroll_init' );
25
26 /**
27 * Custom render function for Infinite Scroll.
28 */
29 function jetpack_twentyseventeen_infinite_scroll_render() {
30 while ( have_posts() ) {
31 the_post();
32 if ( is_search() ) {
33 get_template_part( 'template-parts/post/content', 'search' );
34 } else {
35 get_template_part( 'template-parts/post/content', get_post_format() );
36 }
37 }
38 }
39
40 /**
41 * Custom function to check for the presence of footer widgets or the social links menu
42 */
43 function jetpack_twentyseventeen_has_footer_widgets() {
44 if ( is_active_sidebar( 'sidebar-2' ) ||
45 is_active_sidebar( 'sidebar-3' ) ||
46 has_nav_menu( 'social' ) ) {
47
48 return true;
49 }
50
51 return false;
52 }
53
54 /**
55 * Enqueue CSS stylesheet with theme styles for Infinite Scroll.
56 */
57 function jetpack_twentyseventeen_infinite_scroll_enqueue_styles() {
58 if ( wp_script_is( 'the-neverending-homepage' ) ) {
59 wp_enqueue_style( 'infinity-twentyseventeen', plugins_url( 'twentyseventeen.css', __FILE__ ), array( 'the-neverending-homepage' ), '20161219' );
60 wp_style_add_data( 'infinity-twentyseventeen', 'rtl', 'replace' );
61 }
62 }
63 add_action( 'wp_enqueue_scripts', 'jetpack_twentyseventeen_infinite_scroll_enqueue_styles', 25 );
64