jetpack.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. /**
  3. * Jetpack Compatibility File
  4. *
  5. * @link https://jetpack.com/
  6. *
  7. * @package UIU_CSE
  8. */
  9. /**
  10. * Jetpack setup function.
  11. *
  12. * See: https://jetpack.com/support/infinite-scroll/
  13. * See: https://jetpack.com/support/responsive-videos/
  14. * See: https://jetpack.com/support/content-options/
  15. */
  16. function uiu_cse_jetpack_setup() {
  17. // Add theme support for Infinite Scroll.
  18. add_theme_support(
  19. 'infinite-scroll',
  20. array(
  21. 'container' => 'main',
  22. 'render' => 'uiu_cse_infinite_scroll_render',
  23. 'footer' => 'page',
  24. )
  25. );
  26. // Add theme support for Responsive Videos.
  27. add_theme_support( 'jetpack-responsive-videos' );
  28. // Add theme support for Content Options.
  29. add_theme_support(
  30. 'jetpack-content-options',
  31. array(
  32. 'post-details' => array(
  33. 'stylesheet' => 'uiu-cse-style',
  34. 'date' => '.posted-on',
  35. 'categories' => '.cat-links',
  36. 'tags' => '.tags-links',
  37. 'author' => '.byline',
  38. 'comment' => '.comments-link',
  39. ),
  40. 'featured-images' => array(
  41. 'archive' => true,
  42. 'post' => true,
  43. 'page' => true,
  44. ),
  45. )
  46. );
  47. }
  48. add_action( 'after_setup_theme', 'uiu_cse_jetpack_setup' );
  49. if ( ! function_exists( 'uiu_cse_infinite_scroll_render' ) ) :
  50. /**
  51. * Custom render function for Infinite Scroll.
  52. */
  53. function uiu_cse_infinite_scroll_render() {
  54. while ( have_posts() ) {
  55. the_post();
  56. if ( is_search() ) :
  57. get_template_part( 'template-parts/content', 'search' );
  58. else :
  59. get_template_part( 'template-parts/content', get_post_type() );
  60. endif;
  61. }
  62. }
  63. endif;