Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 14 |
|
0.00% |
0 / 3 |
CRAP | n/a |
0 / 0 |
|
| twentyfourteen_featured_content_post_ids | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
6 | |||
| twentyfourteen_customizer_default | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| twentyfourteen_featured_content_default_settings | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * Jetpack Compatibility File |
| 4 | * See: https://jetpack.com/ |
| 5 | * |
| 6 | * @package automattic/jetpack-classic-theme-helper |
| 7 | */ |
| 8 | |
| 9 | if ( ! defined( 'ABSPATH' ) ) { |
| 10 | exit( 0 ); |
| 11 | } |
| 12 | |
| 13 | if ( ! function_exists( 'twentyfourteen_featured_content_post_ids' ) ) { |
| 14 | /** |
| 15 | * A last try to show posts, in case the Featured Content plugin returns no IDs. |
| 16 | * |
| 17 | * @param array $featured_ids Array of 'featured' post IDs. |
| 18 | * @return array |
| 19 | */ |
| 20 | function twentyfourteen_featured_content_post_ids( $featured_ids ) { |
| 21 | if ( empty( $featured_ids ) ) { |
| 22 | $featured_ids = array_slice( get_option( 'sticky_posts', array() ), 0, 6 ); |
| 23 | } |
| 24 | |
| 25 | return $featured_ids; |
| 26 | } |
| 27 | add_action( 'featured_content_post_ids', 'twentyfourteen_featured_content_post_ids' ); |
| 28 | } |
| 29 | |
| 30 | if ( ! function_exists( 'twentyfourteen_customizer_default' ) ) { |
| 31 | /** |
| 32 | * Set the default tag name for Featured Content. |
| 33 | * |
| 34 | * @param WP_Customize_Manager $wp_customize Theme Customizer object. |
| 35 | * @return void |
| 36 | */ |
| 37 | function twentyfourteen_customizer_default( $wp_customize ) { |
| 38 | $wp_customize->get_setting( 'featured-content[tag-name]' )->default = 'featured'; |
| 39 | } |
| 40 | add_action( 'customize_register', 'twentyfourteen_customizer_default' ); |
| 41 | } |
| 42 | |
| 43 | if ( ! function_exists( 'twentyfourteen_featured_content_default_settings' ) ) { |
| 44 | /** |
| 45 | * Sets a default tag of 'featured' for Featured Content. |
| 46 | * |
| 47 | * @param array $settings Featured content settings. |
| 48 | * @return array |
| 49 | */ |
| 50 | function twentyfourteen_featured_content_default_settings( $settings ) { |
| 51 | $settings['tag-name'] = 'featured'; |
| 52 | |
| 53 | return $settings; |
| 54 | } |
| 55 | add_action( 'featured_content_default_settings', 'twentyfourteen_featured_content_default_settings' ); |
| 56 | } |