/modules/theme-tools/compat/twentyfourteen.php

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