WordPress.org

Ready to get started?Download WordPress

Forums

Infinite-Scroll
Infinite Scroll with Custom Post Types (23 posts)

  1. Adam
    Member
    Posted 2 years ago #

    Infinite Scroll works well with a regular "posts" page, but won't work with a page that displays entries for a Custom Post Type. Is there a way to get this to work?

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

  2. beaver6813
    Member
    Plugin Author

    Posted 2 years ago #

    Hi Adam,
    I'm not sure what you mean by a custom post type, do you have an example of the page?

  3. Adam
    Member
    Posted 2 years ago #

    Thanks for your quick response, beaver6813! Here's WP's description of a Custom Post Type in the Docs: http://codex.wordpress.org/Post_Types#Custom_Types

    An example of a Custom Post Type, personally, would be my portfolio: http://adambaney.com. In the WP back-end, instead of creating a new page or post, I have created a custom post type called "work-entry" in which to house entries (posts) for each work/portfolio item. I simply add a new "Work" entry to have it display on my work/portfolio page (in my case, the Home page).

    Custom Post Types are somewhat new to WP, but so many people are using them. It's a better way to have WP function as a real CMS.

    Does this help? Let me know if you have further questions.

  4. beaver6813
    Member
    Plugin Author

    Posted 2 years ago #

    Hmm, does the script load or get inserted on the page at all? Its designed to hook onto "template_redirect" and WP's script loader (then its just up to you to define the right selectors for the page).
    Also, try out RC1 http://downloads.wordpress.org/plugin/infinite-scroll.2.0b.110822RC1.zip (if you haven't already) as I've made a lot of changes there as to how the script is loaded and under what conditions. I haven't released it fully yet as I still want to test it further.

  5. Adam
    Member
    Posted 2 years ago #

    Hmm, does the script load or get inserted on the page at all?

    It does on my "Posts" page, but not on my "Blog" page.

    I'm testing new functionalities in a sub-domain before I move it to the main site. If you visit http://adambaney.adambaney.com/blog/, you will notice that the WP "previous / next" links are inserted in the page code (do a search for 'class="navigation"'). But, Infinite Scroll isn't triggered.

    I've defined the correct selectors. If you go to my "Posts" page, the script works, but not on my "Blog" page. The 2 pages are identical as far as the code structure. The only difference is that the Blog is a Custom Post Type and the Posts page displays all regular posts.

    I tried the latest build, and nothing changed. Thanks again!

  6. sosukeinu
    Member
    Posted 2 years ago #

    Just wanted to add a "me too" to this thread. I am displaying custom post type via an archive page, and infinite scroll works great on my posts and a regular archive page, but the custom post type seems to break it. I disabled infinite scroll, and the pagination works correctly, but i can't get it to pull in the next page's content. Any help on this would be great, especially seeing how custom post types are everywhere nowadays. Thank you.

  7. beaver6813
    Member
    Plugin Author

    Posted 2 years ago #

    Thanks for the URLs Adam, it helps massively when trying to debug. Looks like the action that infinite-scroll uses to load isn't triggered on custom post type pages for some reason. I'll get my investigating hat on and will hopefully come up with a fix soon. Will post back as soon as I have more info!

  8. beaver6813
    Member
    Plugin Author

    Posted 2 years ago #

    Update: I've kinda recreated on mine, though mine does load the script. (Its just not initializing properly for whatever reason).
    @sosukeinu Do you have an example of yours I can take a look at?

    Thanks

  9. sosukeinu
    Member
    Posted 2 years ago #

    I sure do, but it will require login credentials to see it. if you don't feel comfortable giving your email out here, you can use the feedback form on my site http://pasceverbo.com/fiction. The tab is on the left edge of the screen. Just let me know where to send it, and I'll give you all the info. Sorry to be a pain, and thanks.

  10. Adam
    Member
    Posted 2 years ago #

    Thanks for looking into this, beaver6813! Definitely post back once you've found a fix. :)

  11. sosukeinu
    Member
    Posted 2 years ago #

    any progress on this? I'd love to figure out how to get this working. The script initialized, and the loading image comes up, but the second page is never loaded in. Everything is completely un-styled, but you can see it NOT working here: http://pasceverbo.com/fiction/inspiration/ I added two navigation areas (one with the correct CSS selectors, and one with incorrect selectors) so even after infinite scroll doesn't load the next page in, you can still jump abck and forth to verify that pagination is working. Thank you.

  12. skidding
    Member
    Posted 2 years ago #

    I had the same problem and in my case the fix was simple (even though I had to debug ALL the plugin code to realize it had nothing to do with it). I have different container IDs for the post and custom type listings. #listing for posts and #content in my archive-type.php template.

    So I added this selector values in the plugin admin and both work now.

    • Content CSS Selector: #listing,#content
    • Post CSS Selector: #listing .cell,#content .cell

    Hope this helps other as well.

  13. sosukeinu
    Member
    Posted 2 years ago #

    Awesome! That does the trick for me. of course, now i need to restyle everything, but at least its working. Thank you.

  14. beaver6813
    Member
    Plugin Author

    Posted 2 years ago #

    Really sorry guys for not assisting sooner (been very busy!) I was having slightly different problems to the selectors (the script wasn't being loaded on the custom type page). Glad you found a solution to your issue and hopefully I'll get around to debugging mine soon. Cheers.

  15. Adam
    Member
    Posted 2 years ago #

    Hey, beaver6813. Found a solution yet? I really appreciate you looking into this.

  16. beaver6813
    Member
    Plugin Author

    Posted 2 years ago #

    I haven't had time yet I'm afraid Adam. Is infinite-scroll enabled on your test site?
    http://adambaney.adambaney.com/blog/
    If not then could you enable it? I'm going to download a local copy and debug the hell out of it!

  17. Adam
    Member
    Posted 2 years ago #

    Yes, infinite scroll is enabled. Version 2.0b2.110822 using WP 3.3.1. Thanks! :)

  18. Adam
    Member
    Posted 2 years ago #

    Got the new update to Infinite Scroll (2.0b2.120111). Doesn't seem to have fixed the CPT issue. :(

    Doesn't seem to work anymore on my "posts" page anymore either.
    http://adambaney.adambaney.com/posts/

  19. Adam
    Member
    Posted 2 years ago #

    No longer works with my "posts" page or my "blog" (custom post type) page.

    Posts page:
    http://adambaney.adambaney.com/posts/

    Blog (CPT) page:
    http://adambaney.adambaney.com/blog/

    Using Infinite Scroll Version 2.0b2.120226. Any ideas?

  20. beaver6813
    Member
    Plugin Author

    Posted 2 years ago #

    Hi Adam,
    I can't remember if we tried this but I (fairly) recently put a filter to force infinite-scroll to load on certain pages (its aimed at custom blog pages etc).

    So in your themes functions.php add something like:

    function my_load_infinite_scroll( $load_infinite_scroll ) {
        if( is_page('news') )
            return true;
        return $load_infinite_scroll;
    }
    add_filter('infinite_scroll_load_override', 'my_load_infinite_scroll');

    Obviously you could just edit that function to return true always or add some something that sets a variable in your custom page (which you can then check in the function) or use one of the WordPress functions to. I recognise its not ideal but I haven't really got any time to dig into the code at the moment.

  21. Adam
    Member
    Posted 2 years ago #

    Thanks so much! This worked!

    Now that I've finally gotten over this hurdle, how would I make it work with other CPTs?

    For example, I have my "Work" on my home page. I initially created the page with the title of "Work" and a slug of "work". In the WP Settings, I set the Home page to be the "Work" page.

    In the Settings for Infinite Scroller, I added the proper CSS selectors in conjunction with the CSS selectors for my Blog. These are separated with a comma, e.g. "#content #blogEntries_wrapper .blogEntry, #content #work_wrapper .workEntry".

    In the functions file, maybe this is where I have it wrong? I added the "Home" page to the code (I've also tried "home"):

    function my_load_infinite_scroll( $load_infinite_scroll ) {
        if( is_page('blog', "Home") )
            return true;
        return $load_infinite_scroll;
    }
    add_filter('infinite_scroll_load_override', 'my_load_infinite_scroll');

    Please refresh my site, or clear the browser cache, if there are some display issues.

    Thanks a bunch for your help!

  22. gepetobio
    Member
    Posted 2 years ago #

    I had the same problem of having it working on the blog list but not in a page displaying only one category of posts (not the /category/category-name, one that I created with a <?php query_posts( 'cat=4' ); ?> query). But this latest function fixed the problem:

    function my_load_infinite_scroll( $load_infinite_scroll ) {
        if( is_page('my-page-name') )
            return true;
        return $load_infinite_scroll;
    }
    
    add_filter('infinite_scroll_load_override', 'my_load_infinite_scroll');
  23. 851000
    Member
    Posted 1 year ago #

    Hello!

    I have the same problem!
    I don't know if I use the correct selectors...
    Please take a look at http://www.youandsaturation.com. I have the last version of "Infinite Scroll".

    Can you help me configuring that plugin correctly?

    Thanks in advance!

    Regards,
    Bruno Moura

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic