twentytwelve.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * Infinite Scroll Theme Assets
  4. *
  5. * Register support for Twenty Twelve and enqueue relevant styles.
  6. */
  7. /**
  8. * Add theme support for infinite scroll
  9. */
  10. function jetpack_twentytwelve_infinite_scroll_init() {
  11. add_theme_support( 'infinite-scroll', array(
  12. 'container' => 'content',
  13. 'footer' => 'page',
  14. 'footer_widgets' => jetpack_twentytwelve_has_footer_widgets(),
  15. ) );
  16. }
  17. add_action( 'after_setup_theme', 'jetpack_twentytwelve_infinite_scroll_init' );
  18. /**
  19. * Enqueue CSS stylesheet with theme styles for infinity.
  20. */
  21. function jetpack_twentytwelve_infinite_scroll_enqueue_styles() {
  22. if ( wp_script_is( 'the-neverending-homepage' ) ) {
  23. // Add theme specific styles.
  24. wp_enqueue_style( 'infinity-twentytwelve', plugins_url( 'twentytwelve.css', __FILE__ ), array( 'the-neverending-homepage' ), '20120817' );
  25. }
  26. }
  27. add_action( 'wp_enqueue_scripts', 'jetpack_twentytwelve_infinite_scroll_enqueue_styles', 25 );
  28. /**
  29. * Do we have footer widgets?
  30. */
  31. function jetpack_twentytwelve_has_footer_widgets() {
  32. if ( function_exists( 'jetpack_is_mobile' ) && jetpack_is_mobile() ) {
  33. if ( is_front_page() && ( is_active_sidebar( 'sidebar-2' ) || is_active_sidebar( 'sidebar-3' ) ) )
  34. return true;
  35. elseif ( is_active_sidebar( 'sidebar-1' ) )
  36. return true;
  37. }
  38. return false;
  39. }