Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Enable Infinite scroll
- add_theme_support( 'infinite-scroll', array(
- 'container' => 'wall-posts',
- 'footer' => 'footer',
- 'type' => 'scroll',
- 'wrapper' => false,
- 'posts_per_page' => 11,
- ) );
- // Support Infinite Scroll on other pages
- function tma_jetpack_infinite_scroll_supported() {
- $supported = current_theme_supports( 'infinite-scroll' ) && ( is_home() || is_front_page() );
- return $supported;
- }
- add_filter( 'infinite_scroll_archive_supported', 'tma_jetpack_infinite_scroll_supported' );
- // Add Custom post types to main query on 'Latest' page
- function tma_change_latest_query_to_include_cpt( $query ) {
- if ( ! is_admin() && is_home() && $query->is_main_query() ) {
- $query->set( 'post_type', array('post', 'events', 'galleries', 'videos') );
- $query->set( 'posts_per_page', '11');
- }
- }
- add_action( 'pre_get_posts', 'tma_change_latest_query_to_include_cpt' );
- // Change Infinite scroll query args
- function jetpack_infinite_scroll_query_args( $args ) {
- $args['post_type'] = array('post', 'events', 'galleries', 'videos');
- $args['posts_per_page'] = 11;
- return $args;
- }
- add_filter( 'infinite_scroll_query_args', 'jetpack_infinite_scroll_query_args' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement