jetpack.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. /**
  3. * Jetpack Compatibility File
  4. * See: https://jetpack.me/
  5. *
  6. * @package Publication
  7. */
  8. function publication_jetpack_setup() {
  9. /**
  10. * Add theme support for Infinite Scroll.
  11. * See: https://jetpack.me/support/infinite-scroll/
  12. */
  13. add_theme_support( 'infinite-scroll', array(
  14. 'container' => 'main',
  15. 'render' => 'publication_infinite_scroll_render',
  16. 'footer' => 'page',
  17. ) );
  18. /**
  19. * Add theme support for Responsive Videos.
  20. */
  21. add_theme_support( 'jetpack-responsive-videos' );
  22. /**
  23. * Add theme support for Logo upload.
  24. */
  25. add_image_size( 'publication-logo', 324, 108 );
  26. add_theme_support( 'site-logo', array( 'size' => 'publication-logo' ) );
  27. }
  28. add_action( 'after_setup_theme', 'publication_jetpack_setup' );
  29. /**
  30. * Custom render function for Infinite Scroll.
  31. */
  32. function publication_infinite_scroll_render() {
  33. while ( have_posts() ) {
  34. the_post();
  35. get_template_part( 'template-parts/content', get_post_format() );
  36. }
  37. }
  38. /**
  39. * Make sure publication_post_classes() isn't loaded on Infinite Scroll.
  40. */
  41. function publication_remove_post_classes() {
  42. remove_filter( 'post_class', 'publication_post_classes' );
  43. }
  44. add_action( 'infinite_scroll_render', 'publication_remove_post_classes' );
  45. /**
  46. * Remove sharedaddy from excerpt.
  47. */
  48. function publication_remove_sharedaddy() {
  49. remove_filter( 'the_excerpt', 'sharing_display', 19 );
  50. }
  51. add_action( 'loop_start', 'publication_remove_sharedaddy' );
  52. /**
  53. * Return early if Site Logo is not available.
  54. */
  55. function publication_the_site_logo() {
  56. if ( ! function_exists( 'jetpack_the_site_logo' ) ) {
  57. return;
  58. } else {
  59. jetpack_the_site_logo();
  60. }
  61. }