twentyeleven.css
7 months ago
twentyeleven.php
7 months ago
twentyfifteen-rtl.css
11 years ago
twentyfifteen.css
7 months ago
twentyfifteen.php
7 months ago
twentyfourteen.css
7 months ago
twentyfourteen.php
7 months ago
twentyseventeen-rtl.css
9 years ago
twentyseventeen.css
7 months ago
twentyseventeen.php
7 months ago
twentysixteen-rtl.css
10 years ago
twentysixteen.css
7 months ago
twentysixteen.php
7 months ago
twentyten.css
7 months ago
twentyten.php
7 months ago
twentythirteen.css
7 months ago
twentythirteen.php
7 months ago
twentytwelve.css
7 months ago
twentytwelve.php
7 months ago
twentyseventeen.php
68 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Infinite Scroll Theme Assets |
| 4 | * |
| 5 | * Register support for Twenty Seventeen. |
| 6 | * |
| 7 | * @package jetpack |
| 8 | */ |
| 9 | |
| 10 | if ( ! defined( 'ABSPATH' ) ) { |
| 11 | exit( 0 ); |
| 12 | } |
| 13 | |
| 14 | /** |
| 15 | * Add theme support for infinite scroll |
| 16 | */ |
| 17 | function jetpack_twentyseventeen_infinite_scroll_init() { |
| 18 | add_theme_support( |
| 19 | 'infinite-scroll', |
| 20 | array( |
| 21 | 'container' => 'main', |
| 22 | 'render' => 'jetpack_twentyseventeen_infinite_scroll_render', |
| 23 | 'footer' => 'content', |
| 24 | 'footer_widgets' => jetpack_twentyseventeen_has_footer_widgets(), |
| 25 | ) |
| 26 | ); |
| 27 | } |
| 28 | add_action( 'init', 'jetpack_twentyseventeen_infinite_scroll_init' ); |
| 29 | |
| 30 | /** |
| 31 | * Custom render function for Infinite Scroll. |
| 32 | */ |
| 33 | function jetpack_twentyseventeen_infinite_scroll_render() { |
| 34 | while ( have_posts() ) { |
| 35 | the_post(); |
| 36 | if ( is_search() ) { |
| 37 | get_template_part( 'template-parts/post/content', 'search' ); |
| 38 | } else { |
| 39 | get_template_part( 'template-parts/post/content', get_post_format() ); |
| 40 | } |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * Custom function to check for the presence of footer widgets or the social links menu |
| 46 | */ |
| 47 | function jetpack_twentyseventeen_has_footer_widgets() { |
| 48 | if ( is_active_sidebar( 'sidebar-2' ) || |
| 49 | is_active_sidebar( 'sidebar-3' ) || |
| 50 | has_nav_menu( 'social' ) ) { |
| 51 | |
| 52 | return true; |
| 53 | } |
| 54 | |
| 55 | return false; |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * Enqueue CSS stylesheet with theme styles for Infinite Scroll. |
| 60 | */ |
| 61 | function jetpack_twentyseventeen_infinite_scroll_enqueue_styles() { |
| 62 | if ( wp_script_is( 'the-neverending-homepage' ) ) { |
| 63 | wp_enqueue_style( 'infinity-twentyseventeen', plugins_url( 'twentyseventeen.css', __FILE__ ), array( 'the-neverending-homepage' ), '20161219' ); |
| 64 | wp_style_add_data( 'infinity-twentyseventeen', 'rtl', 'replace' ); |
| 65 | } |
| 66 | } |
| 67 | add_action( 'wp_enqueue_scripts', 'jetpack_twentyseventeen_infinite_scroll_enqueue_styles', 25 ); |
| 68 |