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?
I’m not sure what you mean by a custom post type, do you have an example of the page?
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.
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.
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!
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.
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!
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?
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.
Thanks for looking into this, beaver6813! Definitely post back once you’ve found a fix. 🙂
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.
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.
Awesome! That does the trick for me. of course, now i need to restyle everything, but at least its working. Thank you.
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.
Hey, beaver6813. Found a solution yet? I really appreciate you looking into this.
- The topic ‘Infinite Scroll with Custom Post Types’ is closed to new replies.