twentyfifteen-rtl.css
7 years ago
twentyfifteen.css
4 years ago
twentyfifteen.php
4 years ago
twentyfourteen-rtl.css
7 years ago
twentyfourteen.css
4 years ago
twentyfourteen.php
4 years ago
twentynineteen-rtl.css
2 years ago
twentynineteen.css
3 years ago
twentynineteen.php
4 years ago
twentyseventeen.php
4 years ago
twentysixteen-rtl.css
3 years ago
twentysixteen.css
3 years ago
twentysixteen.php
2 years ago
twentytwenty-rtl.css
2 years ago
twentytwenty.css
4 years ago
twentytwenty.php
4 years ago
twentytwentyone-rtl.css
3 years ago
twentytwentyone.css
5 years ago
twentytwentyone.php
5 years ago
twentyfourteen.php
83 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Jetpack Compatibility File |
| 4 | * See: https://jetpack.com/ |
| 5 | * |
| 6 | * @package automattic/jetpack |
| 7 | */ |
| 8 | |
| 9 | /** |
| 10 | * A last try to show posts, in case the Featured Content plugin returns no IDs. |
| 11 | * |
| 12 | * @param array $featured_ids Array of 'featured' post IDs. |
| 13 | * @return array |
| 14 | */ |
| 15 | function twentyfourteen_featured_content_post_ids( $featured_ids ) { |
| 16 | if ( empty( $featured_ids ) ) { |
| 17 | $featured_ids = array_slice( get_option( 'sticky_posts', array() ), 0, 6 ); |
| 18 | } |
| 19 | |
| 20 | return $featured_ids; |
| 21 | } |
| 22 | add_action( 'featured_content_post_ids', 'twentyfourteen_featured_content_post_ids' ); |
| 23 | |
| 24 | /** |
| 25 | * Set the default tag name for Featured Content. |
| 26 | * |
| 27 | * @param WP_Customize_Manager $wp_customize Theme Customizer object. |
| 28 | * @return void |
| 29 | */ |
| 30 | function twentyfourteen_customizer_default( $wp_customize ) { |
| 31 | $wp_customize->get_setting( 'featured-content[tag-name]' )->default = 'featured'; |
| 32 | } |
| 33 | add_action( 'customize_register', 'twentyfourteen_customizer_default' ); |
| 34 | |
| 35 | /** |
| 36 | * Sets a default tag of 'featured' for Featured Content. |
| 37 | * |
| 38 | * @param array $settings Featured content settings. |
| 39 | * @return array |
| 40 | */ |
| 41 | function twentyfourteen_featured_content_default_settings( $settings ) { |
| 42 | $settings['tag-name'] = 'featured'; |
| 43 | |
| 44 | return $settings; |
| 45 | } |
| 46 | add_action( 'featured_content_default_settings', 'twentyfourteen_featured_content_default_settings' ); |
| 47 | |
| 48 | /** |
| 49 | * Removes sharing markup from post content if we're not in the loop and it's a |
| 50 | * formatted post. |
| 51 | * |
| 52 | * @param bool $show Whether to show sharing options. |
| 53 | * @param WP_Post $post The post to share. |
| 54 | * @return bool |
| 55 | */ |
| 56 | function twentyfourteen_mute_content_filters( $show, $post ) { |
| 57 | $formats = get_theme_support( 'post-formats' ); |
| 58 | if ( ! in_the_loop() && has_post_format( $formats[0], $post ) ) { |
| 59 | $show = false; |
| 60 | } |
| 61 | return $show; |
| 62 | } |
| 63 | add_filter( 'sharing_show', 'twentyfourteen_mute_content_filters', 10, 2 ); |
| 64 | |
| 65 | /** |
| 66 | * Enqueue Jetpack compat styles for Twenty Fourteen. |
| 67 | */ |
| 68 | function twentyfourteen_init_jetpack() { |
| 69 | /** |
| 70 | * Add our compat CSS file for custom widget stylings and such. |
| 71 | * Set the version equal to filemtime for development builds, and the JETPACK__VERSION for production. |
| 72 | */ |
| 73 | if ( ! is_admin() ) { |
| 74 | $version = false; |
| 75 | if ( method_exists( 'Jetpack', 'is_development_version' ) ) { |
| 76 | $version = Jetpack::is_development_version() ? filemtime( plugin_dir_path( __FILE__ ) . 'twentyfourteen.css' ) : JETPACK__VERSION; |
| 77 | } |
| 78 | wp_enqueue_style( 'twentyfourteen-jetpack', plugins_url( 'twentyfourteen.css', __FILE__ ), array(), $version ); |
| 79 | wp_style_add_data( 'twentyfourteen-jetpack', 'rtl', 'replace' ); |
| 80 | } |
| 81 | } |
| 82 | add_action( 'init', 'twentyfourteen_init_jetpack' ); |
| 83 |