PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3
Jetpack – WP Security, Backup, Speed, & Growth v16.3
16.3 16.3-beta 16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 16.2 16.2-beta 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 All 508 releases
← All changes | modules/infinite-scroll/themes/twentyfourteen.php +60 -0 16.2-beta → 16.3 View file →
@@ -1,0 +1,60 @@
1 +<?php
2 +/**
3 + * Infinite Scroll Theme Assets
4 + *
5 + * Register support for Twenty Fourteen.
6 + *
7 + * @package jetpack
8 + */
9 +
10 +use Automattic\Jetpack\Device_Detection\User_Agent_Info;
11 +
12 +if ( ! defined( 'ABSPATH' ) ) {
13 + exit( 0 );
14 +}
15 +
16 +/**
17 + * Add theme support for infinite scroll
18 + */
19 +function jetpack_twentyfourteen_infinite_scroll_init() {
20 + add_theme_support(
21 + 'infinite-scroll',
22 + array(
23 + 'container' => 'content',
24 + 'footer' => 'page',
25 + 'footer_widgets' => jetpack_twentyfourteen_has_footer_widgets(),
26 + )
27 + );
28 +}
29 +add_action( 'after_setup_theme', 'jetpack_twentyfourteen_infinite_scroll_init' );
30 +
31 +/**
32 + * Switch to the "click to load" type IS with the following cases
33 + * 1. Viewed from iPad and the primary sidebar is active.
34 + * 2. Viewed from mobile and either the primary or the content sidebar is active.
35 + * 3. The footer widget is active.
36 + *
37 + * @return bool
38 + */
39 +function jetpack_twentyfourteen_has_footer_widgets() {
40 + if ( function_exists( 'jetpack_is_mobile' ) ) {
41 + if ( ( User_Agent_Info::is_ipad() && is_active_sidebar( 'sidebar-1' ) )
42 + || ( jetpack_is_mobile( '', true ) && ( is_active_sidebar( 'sidebar-1' ) || is_active_sidebar( 'sidebar-2' ) ) )
43 + || is_active_sidebar( 'sidebar-3' ) ) {
44 +
45 + return true;
46 + }
47 + }
48 +
49 + return false;
50 +}
51 +
52 +/**
53 + * Enqueue CSS stylesheet with theme styles for Infinite Scroll.
54 + */
55 +function jetpack_twentyfourteen_infinite_scroll_enqueue_styles() {
56 + if ( wp_script_is( 'the-neverending-homepage' ) ) {
57 + wp_enqueue_style( 'infinity-twentyfourteen', plugins_url( 'twentyfourteen.css', __FILE__ ), array( 'the-neverending-homepage' ), '20131118' );
58 + }
59 +}
60 +add_action( 'wp_enqueue_scripts', 'jetpack_twentyfourteen_infinite_scroll_enqueue_styles', 25 );