| 1 |
<?php |
| 2 |
/* |
| 3 |
* Load code specific to themes or theme tools |
| 4 |
*/ |
| 5 |
|
| 6 |
/** |
| 7 |
* INFINITE SCROLL |
| 8 |
*/ |
| 9 |
|
| 10 |
/** |
| 11 |
* Load theme's infinite scroll annotation file, if present in the IS plugin. |
| 12 |
* The `setup_theme` action is used because the annotation files should be using `after_setup_theme` to register support for IS. |
| 13 |
* |
| 14 |
* As released in Jetpack 2.0, a child theme's parent wasn't checked for in the plugin's bundled support, hence the convoluted way the parent is checked for now. |
| 15 |
* |
| 16 |
* @uses is_admin, wp_get_theme, get_theme, get_current_theme, apply_filters |
| 17 |
* @action setup_theme |
| 18 |
* @return null |
| 19 |
*/ |
| 20 |
function jetpack_load_infinite_scroll_annotation() { |
| 21 |
if ( is_admin() && isset( $_GET['page'] ) && 'jetpack' == $_GET['page'] ) { |
| 22 |
$theme = function_exists( 'wp_get_theme' ) ? wp_get_theme() : get_theme( get_current_theme() ); |
| 23 |
|
| 24 |
if ( ! is_a( $theme, 'WP_Theme' ) && ! is_array( $theme ) ) |
| 25 |
return; |
| 26 |
|
| 27 |
$customization_file = apply_filters( 'infinite_scroll_customization_file', dirname( __FILE__ ) . "/infinite-scroll/themes/{$theme['Stylesheet']}.php", $theme['Stylesheet'] ); |
| 28 |
|
| 29 |
if ( is_readable( $customization_file ) ) { |
| 30 |
require_once( $customization_file ); |
| 31 |
} |
| 32 |
elseif ( ! empty( $theme['Template'] ) ) { |
| 33 |
$customization_file = dirname( __FILE__ ) . "/infinite-scroll/themes/{$theme['Template']}.php"; |
| 34 |
|
| 35 |
if ( is_readable( $customization_file ) ) |
| 36 |
require_once( $customization_file ); |
| 37 |
} |
| 38 |
} |
| 39 |
} |
| 40 |
add_action( 'setup_theme', 'jetpack_load_infinite_scroll_annotation' ); |
| 41 |
|
| 42 |
/** |
| 43 |
* Prevent IS from being activated if theme doesn't support it |
| 44 |
* |
| 45 |
* @param bool $can_activate |
| 46 |
* @filter jetpack_can_activate_infinite-scroll |
| 47 |
* @return bool |
| 48 |
*/ |
| 49 |
function jetpack_can_activate_infinite_scroll( $can_activate ) { |
| 50 |
return (bool) current_theme_supports( 'infinite-scroll' ); |
| 51 |
} |
| 52 |
add_filter( 'jetpack_can_activate_infinite-scroll', 'jetpack_can_activate_infinite_scroll' ); |
| 53 |
|
| 54 |
require_once( dirname( __FILE__ ) . '/featured-content/featured-content.php' ); |
| 55 |
|
| 56 |
require_once( dirname( __FILE__ ) . '/social-links.php' ); |
| 57 |
|
| 58 |
require_once( dirname( __FILE__ ) . '/tonesque.php' ); |
| 59 |
|
| 60 |
// Custom Post Types - we don't want a module card for these (yet) |
| 61 |
require_once( dirname( __FILE__ ) . '/custom-post-types/comics.php' ); |
| 62 |
require_once( dirname( __FILE__ ) . '/custom-post-types/testimonial.php' ); |
| 63 |
require_once( dirname( __FILE__ ) . '/custom-post-types/nova.php' ); |
| 64 |
|
| 65 |
require_once( dirname( __FILE__ ) . '/random-redirect.php' ); |
| 66 |
|