twentyeleven.css
5 years ago
twentyeleven.php
4 years ago
twentyfifteen-rtl.css
11 years ago
twentyfifteen.css
11 years ago
twentyfifteen.php
4 years ago
twentyfourteen.css
11 years ago
twentyfourteen.php
4 years ago
twentyseventeen-rtl.css
9 years ago
twentyseventeen.css
9 years ago
twentyseventeen.php
4 years ago
twentysixteen-rtl.css
10 years ago
twentysixteen.css
10 years ago
twentysixteen.php
4 years ago
twentyten.css
11 years ago
twentyten.php
4 years ago
twentythirteen.css
13 years ago
twentythirteen.php
4 years ago
twentytwelve.css
11 years ago
twentytwelve.php
4 years ago
twentyseventeen.php
64 lines
| 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 |