WordPress.org

Ready to get started?Download WordPress

Forums

Infinite-Scroll
[resolved] query vars changed via pre_get_posts not respected by infinite scroll (2 posts)

  1. helgatheviking
    Member
    Posted 1 year ago #

    posted on github, reposting here:

    i've modified my main query to add a second post type

    function add_external_videos_to_query( $query ) {
    
        if ( is_main_query() && is_home() )
            set_query_var ( 'post_type', array('post','external-videos') );
    }
    add_action( 'pre_get_posts', 'add_external_videos_to_query' );

    without the infinite scroll plugin enabled (Version 2.0b2.120226) visiting pages 2, 3, etc show mixed posts of both post type as expected. however, when using infinite scroll, posts of other post types do not appear in the added content.

    https://github.com/paulirish/infinite-scroll/issues/77 implies that the pre_get_posts filter should work fine w/ infinite scroll, but i am not experiencing 404s on the paged pages, i'm just not seeing the second post type... in this case 'external-videos'.

    infinite scroll goes to the next page and scrapes the data from a specific div, but it seems like the pre_get_posts filter is not being run. i

    what hook does the infinite scroll run on? what logic should be used so that the infinite scroll requests also run the filter?

    http://wordpress.org/extend/plugins/infinite-scroll/

  2. helgatheviking
    Member
    Posted 1 year ago #

    never mind:
    http://wordpress.org/support/topic/plugin-infinite-scroll-how-to-know-css-selector-values-infinite-scroll?replies=21

    the solution was mentioned already. the CSS selector was not the same for both types of posts.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic