Custom Post Type Archive Not Displaying

Hello!

I have created a custom post type via the CPT UI plugin called “Recipes”.

I was able to build a “Single Page” layout for the condition “Post Type is Recipe” without a problem, however when attempting to creating an “Archive Page” layout for the condition “Post Type is Recipe” I am getting a 404 error when I view “[domain here].com/recipes”.

I have checked the CPT UI settings to ensure that the post type “Recipes” has “Has Archive” set to true and the “Custom Rewrite Slug” is set to “/recipes”. I have also checked that the “Single Page” for “Recipes” is displaying successfully when I view “[domain here].com/recipes/[recipe title here]”.

Is there something else I am missing? Attached are my credentials.

Thanks!

Hi @michigancreative,

Thanks for reaching out!

I suspect it has something to do with your Rewrite Slug “/recipes” because when you are going to remove that rewrite URL the yoursite.com/recipes archive page will work. I suggest that you remove your Rewrite slug.

Hope that helps.

Thank you.

1 Like

Hey @marc_a,

Thanks so much for replying so quickly, I really appreciate it! Your solution fixed my issue right away!

I have one additional issue that you might be able to help with. I would like this page layout to be the same for when viewing a category of recipe as well, such as “entree” “sides” or “desserts”.

I have copied the layout 3 times, adjusted the looper consumers to display the feed for that specific category, and have adjusted the conditions to apply for if the post category or if the post recipe is the appropriate category, however when I view yoursite.com/category/[category title here] I get a 404 error. It’s odd because on the preview it appears to work just fine.

Hopefully you can help with this! Ideally, I would like to not have to copy the layout for each category, but if I have to that works too.

Thanks!

Hi @michigancreative,

This is a bit odd on my own opinion but in order for the Layout Builder to show properly on the category, you need to create a posts then assign it to the specific category. See secure note for what I mean.

Thank you.

1 Like

Hey @marc_a,

Thanks so much for this solution! Definitely not something I would have thought of right away haha.

Thanks!

Hi @michigancreative,

You’re welcome and it’s our pleasure to help you! If you have any other concerns or clarifications regarding our theme features, feel free to open up a new thread.

Thank you.

1 Like

Hey @marc_a,

Sorry to bother you again, but I am having trouble getting the pagation to work on the Entrée category page. It displays 2 posts out of the 3 (which is the theme default), but it doesn’t display the pagation. Any ideas?

Thanks!

Hello @michigancreative,

For Archive layouts, you are not supposed to have Looper Provider since any of the WordPress archives has already a loop running in it. This is mostly the reason why the pagination is not working. Kindly edit your Entrée category layout and simply disable the Looper Provider. Saved your changes and test your archive layout. The pagination should be working as expected.

Kindly let us know how it goes.

Hey @ruenel

I have taken your suggestion and disabled the looper provider, however when I do so it doesn’t show my recipes at all, it only displays the “Test 1” post that I was told to create to get the categories to work, as suggested by @marc_a.

Thanks!

Hi @michigancreative,

The reason behind the pagination won’t work is the Looper and Post Pagination elements are not connected. For now pagination and the navigation element works with only a few pre-defined templates. I would suggest you use any of the pre-defined templates and change the design according to your need.

Thanks

Hey @tristup

Will the pre-defined templates allow me to query my custom post type? Or will it only query the standard wordpress “post” type?

Thanks

Hi @michigancreative,

Yes, you can add your own custom queries through the Looper Provider.

Thanks

@tristup

Gotcha! I thought you mentioned in your previous comment NOT to use the looper provider, but I guess it’s only okay when using the predefined templates?

Thanks!

Hi @michigancreative,

Glad that we are able to help you.

Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.