| 1 |
<?php |
| 2 |
/** |
| 3 |
* Infinite Scroll Theme Assets |
| 4 |
* |
| 5 |
* Register support for @Twenty Eleven and enqueue relevant styles. |
| 6 |
* |
| 7 |
* @package jetpack |
| 8 |
*/ |
| 9 |
|
| 10 |
if ( ! defined( 'ABSPATH' ) ) { |
| 11 |
exit( 0 ); |
| 12 |
} |
| 13 |
|
| 14 |
/** |
| 15 |
* Add theme support for infinity scroll |
| 16 |
*/ |
| 17 |
function jetpack_twentyeleven_infinite_scroll_init() { |
| 18 |
add_theme_support( |
| 19 |
'infinite-scroll', |
| 20 |
array( |
| 21 |
'container' => 'content', |
| 22 |
'footer' => 'page', |
| 23 |
'footer_widgets' => jetpack_twentyeleven_has_footer_widgets(), |
| 24 |
) |
| 25 |
); |
| 26 |
} |
| 27 |
add_action( 'init', 'jetpack_twentyeleven_infinite_scroll_init' ); |
| 28 |
|
| 29 |
/** |
| 30 |
* Enqueue CSS stylesheet with theme styles for infinity. |
| 31 |
*/ |
| 32 |
function jetpack_twentyeleven_infinite_scroll_enqueue_styles() { |
| 33 |
if ( wp_script_is( 'the-neverending-homepage' ) ) { |
| 34 |
// Add theme specific styles. |
| 35 |
wp_enqueue_style( 'infinity-twentyeleven', plugins_url( 'twentyeleven.css', __FILE__ ), array( 'the-neverending-homepage' ), '20121002' ); |
| 36 |
} |
| 37 |
} |
| 38 |
add_action( 'wp_enqueue_scripts', 'jetpack_twentyeleven_infinite_scroll_enqueue_styles', 25 ); |
| 39 |
|
| 40 |
/** |
| 41 |
* Do we have footer widgets? |
| 42 |
*/ |
| 43 |
function jetpack_twentyeleven_has_footer_widgets() { |
| 44 |
// Are any of the "Footer Area" sidebars active? |
| 45 |
if ( is_active_sidebar( 'sidebar-3' ) || is_active_sidebar( 'sidebar-4' ) || is_active_sidebar( 'sidebar-5' ) ) { |
| 46 |
return true; |
| 47 |
} |
| 48 |
|
| 49 |
// If we're on mobile and the Main Sidebar has widgets, it falls below the content, so we have footer widgets. |
| 50 |
if ( function_exists( 'jetpack_is_mobile' ) && jetpack_is_mobile() && is_active_sidebar( 'sidebar-1' ) ) { |
| 51 |
return true; |
| 52 |
} |
| 53 |
|
| 54 |
return false; |
| 55 |
} |
| 56 |
|