Advertisement
TheMightyAnt

Jking - Functions

May 1st, 2015
412
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.32 KB | None | 0 0
  1.    // Enable Infinite scroll
  2.    add_theme_support( 'infinite-scroll', array(
  3.       'container' => 'wall-posts',
  4.       'footer' => 'footer',
  5.       'type' => 'scroll',
  6.       'wrapper' => false,
  7.       'posts_per_page' => 11,
  8.    ) );
  9.      
  10.    
  11.    // Support Infinite Scroll on other pages
  12.    function tma_jetpack_infinite_scroll_supported() {
  13.       $supported = current_theme_supports( 'infinite-scroll' ) && ( is_home() || is_front_page() );
  14.       return $supported;
  15.    }
  16.    add_filter( 'infinite_scroll_archive_supported', 'tma_jetpack_infinite_scroll_supported' );
  17.    
  18.    
  19.    // Add Custom post types to main query on 'Latest' page
  20.    function tma_change_latest_query_to_include_cpt( $query ) {
  21.       if ( ! is_admin() && is_home() && $query->is_main_query() ) {
  22.          $query->set( 'post_type', array('post', 'events', 'galleries', 'videos') );
  23.          $query->set( 'posts_per_page', '11');
  24.       }
  25.    }  
  26.    add_action( 'pre_get_posts', 'tma_change_latest_query_to_include_cpt' );
  27.    
  28.    
  29.    // Change Infinite scroll query args
  30.    function jetpack_infinite_scroll_query_args( $args ) {
  31.       $args['post_type'] = array('post', 'events', 'galleries', 'videos');
  32.       $args['posts_per_page'] = 11;
  33.    
  34.       return $args;
  35.    }
  36.    add_filter( 'infinite_scroll_query_args', 'jetpack_infinite_scroll_query_args' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement