twentyten.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /**
  3. * Infinite Scroll Theme Assets
  4. *
  5. * Register support for @Twenty Ten and enqueue relevant styles.
  6. */
  7. /**
  8. * Add theme support for infinity scroll
  9. */
  10. function jetpack_twentyten_infinite_scroll_init() {
  11. add_theme_support( 'infinite-scroll', array(
  12. 'container' => 'content',
  13. 'render' => 'jetpack_twentyten_infinite_scroll_render',
  14. 'footer' => 'wrapper',
  15. 'footer_widgets' => jetpack_twentyten_has_footer_widgets(),
  16. ) );
  17. }
  18. add_action( 'init', 'jetpack_twentyten_infinite_scroll_init' );
  19. /**
  20. * Set the code to be rendered on for calling posts,
  21. * hooked to template parts when possible.
  22. *
  23. * Note: must define a loop.
  24. */
  25. function jetpack_twentyten_infinite_scroll_render() {
  26. get_template_part( 'loop' );
  27. }
  28. /**
  29. * Enqueue CSS stylesheet with theme styles for infinity.
  30. */
  31. function jetpack_twentyten_infinite_scroll_enqueue_styles() {
  32. if ( wp_script_is( 'the-neverending-homepage' ) ) {
  33. // Add theme specific styles.
  34. wp_enqueue_style( 'infinity-twentyten', plugins_url( 'twentyten.css', __FILE__ ), array( 'the-neverending-homepage' ), '20121002' );
  35. }
  36. }
  37. add_action( 'wp_enqueue_scripts', 'jetpack_twentyten_infinite_scroll_enqueue_styles', 25 );
  38. /**
  39. * Do we have footer widgets?
  40. */
  41. function jetpack_twentyten_has_footer_widgets() {
  42. if ( is_active_sidebar( 'first-footer-widget-area' ) ||
  43. is_active_sidebar( 'second-footer-widget-area' ) ||
  44. is_active_sidebar( 'third-footer-widget-area' ) ||
  45. is_active_sidebar( 'fourth-footer-widget-area' ) ) {
  46. return true;
  47. }
  48. return false;
  49. }