jetpack.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <?php
  2. /**
  3. * Jetpack Compatibility File.
  4. *
  5. * @link https://jetpack.me/
  6. *
  7. * @package Ixion
  8. */
  9. /**
  10. * Jetpack setup function.
  11. *
  12. * See: https://jetpack.me/support/infinite-scroll/
  13. * See: https://jetpack.me/support/responsive-videos/
  14. */
  15. function ixion_jetpack_setup() {
  16. // Add theme support for Infinite Scroll.
  17. add_theme_support( 'infinite-scroll', array(
  18. 'container' => 'main',
  19. 'render' => 'ixion_infinite_scroll_render',
  20. 'footer_widgets' => array( 'sidebar-2', 'sidebar-3', 'sidebar-4', 'sidebar-5' ),
  21. 'footer' => 'page',
  22. ) );
  23. //Add theme support for Featured Content
  24. add_theme_support( 'featured-content', array(
  25. 'filter' => 'ixion_get_featured_posts',
  26. 'max_posts' => 3,
  27. 'post_types' => array( 'post', 'page' )
  28. ));
  29. //Add theme support for Content Options.
  30. add_theme_support( 'jetpack-content-options', array(
  31. 'blog-display' => 'content',
  32. 'author-bio' => true,
  33. 'post-details' => array(
  34. 'stylesheet' => 'ixion-style',
  35. 'date' => '.posted-on',
  36. 'categories' => '.cat-links',
  37. 'tags' => '.tags-links',
  38. 'author' => '.byline',
  39. ),
  40. 'featured-images' => array(
  41. 'archive' => true, // enable or not the featured image check for archive pages: true or false
  42. 'archive-default' => false, // the default setting of the featured image on archive pages, if it's enabled or not: true or false
  43. 'post' => true, // enable or not the featured image check for single posts: true or false
  44. 'page' => true, // enable or not the featured image check for single pages: true or false
  45. ),
  46. ) );
  47. // Add theme support for Testimonials.
  48. add_theme_support( 'jetpack-testimonial' );
  49. // Add theme support for Responsive Videos.
  50. add_theme_support( 'jetpack-responsive-videos' );
  51. // Add theme support for Social Menus
  52. add_theme_support( 'jetpack-social-menu' );
  53. }
  54. add_action( 'after_setup_theme', 'ixion_jetpack_setup' );
  55. /**
  56. * Custom render function for Infinite Scroll.
  57. */
  58. function ixion_infinite_scroll_render() {
  59. while ( have_posts() ) {
  60. the_post();
  61. if ( is_search() ) :
  62. get_template_part( 'components/post/content', 'search' );
  63. else :
  64. get_template_part( 'components/post/content', get_post_format() );
  65. endif;
  66. }
  67. }
  68. /**
  69. * Return early if Social Menu is not available.
  70. */
  71. function ixion_social_menu() {
  72. if ( ! function_exists( 'jetpack_social_menu' ) ) {
  73. return;
  74. } else {
  75. jetpack_social_menu();
  76. }
  77. }
  78. /**
  79. * Return early if Author Bio is not available.
  80. */
  81. function ixion_author_bio() {
  82. if ( ! function_exists( 'jetpack_author_bio' ) ) {
  83. get_template_part( 'components/post/content', 'author' );
  84. } else {
  85. jetpack_author_bio();
  86. }
  87. }
  88. /**
  89. * Author Bio Avatar Size.
  90. */
  91. function ixion_author_bio_avatar_size() {
  92. return 60;
  93. }
  94. add_filter( 'jetpack_author_bio_avatar_size', 'ixion_author_bio_avatar_size' );
  95. /**
  96. * Featured Posts
  97. */
  98. function ixion_has_multiple_featured_posts() {
  99. $featured_posts = apply_filters( 'ixion_get_featured_posts', array() );
  100. if ( is_array( $featured_posts ) && 1 < count( $featured_posts ) ) {
  101. return true;
  102. }
  103. return false;
  104. }
  105. function ixion_get_featured_posts() {
  106. return apply_filters( 'ixion_get_featured_posts', false );
  107. }