Skip Navigation

[Resolved] show posts from different cpt in a single archive

This support ticket is created 2 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 15 replies, has 2 voices.

Last updated by Shane 2 years, 9 months ago.

Assisted by: Shane.

Author
Posts
#2420983

Hi,
I have 2 CPT (tender & tender-technical) and I created one archive for those.
How can I show all posts from these CPT "merging" the records in the same page?

update: if I understood correctly I need nested view but nested view isn't supported yet in Toolset Blocks. I works with Blocks now, it is easy (and necessary?) to convert my work to classic Toolset Views? Is there any other solution to achieve this?

Any help would appreciated,
George

#2421127

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi George,

Thank you for getting in touch.

If I understand correctly you want to include another post type in your custom post type archive ?

For e.g if you're viewing the archive for tender then you want to show the tender-technical posts as well on this archive ?

Are these post types related through a post relationship ?

Please let me know.
Thanks,
Shane

#2421451

Hi,
I want to show/display combined all the posts from 2 different cpt in 1 archive page.
No there is no relationship but they use the same taxonomy and custom fields and layout.

#2421689

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

In a case like this you will create the archive page as normal and then below the archive's view block you will create another view block that will list out the posts from the other post type that you want to display.

This should allow you to display both post types on the same archive.

Thanks,
Shane

#2421707

Hi Shane,
I managed to create a common archive and the posts are showing up from both CPT.
Now the post are showing but they are not combined and sorted by post date.
How can I achive this? Please note that I using the legacy Toolset View.
Also, how can I add a search field to search in the posts?

Shane: your last answer is not showing in the ticket history but only in the email i received.

#2421721

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

The only way I see working around this is when you create the archive, you do not use the archive loop, essentially leaving that empty.

Now on the view that is created on the archive you will select both post types to be displayed by the view, then they should be combined.

Please let me know if after doing this if everything is ok now.

Thanks,
Shane

#2422047

Hi,
Something is going on with the loop:
the page is looping the same first 10 post (along with the search box) 10 times in the first page and in every page looping again 10 times the next posts.
How can I loop only once in every page?
George

#2422495

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

Would you mind allowing me to have admin access to the website so that I can have a more detailed look at this for you ?

Please where applicable please provide me with a link to an example page where I can see the issue.

I've enabled the private fields for your next response.

Thanks,
Shane

#2422507

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

The problem was that you added the view inside the archive loop block. You should've added it outside this like below.
hidden link

Now all you need to do is to add the pagination to the view itself rather than the archive.
hidden link

Thanks,
Shane

#2422529

Thank you for the fix!!
I saw your archive block-editor page where you build the loop but I'm checking the "All Tenders" view and can't see any difference. I'm still seeing the "loop-item-in-all-tenders" in Avada builder, I'm still seeing the same filter and navigation options.
So I don't need this View (All Tenders) at all?
Everything created in the archive page?

#2422533

Can I re-enable the Toolset Blocks and disable the Views or should I keep the Views in order to combine 2 CPT in 1 view?

#2422683

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

I saw your archive block-editor page where you build the loop but I'm checking the "All Tenders" view and can't see any difference.

There is a difference, previously you inserted your view inside the archive loop. However I removed the view from the archive loop and placed it outside of the archive loop. If you look at the block navigation menu you will see it being depicted.

So I don't need this View (All Tenders) at all?

The view is still needed because it is being used to display the custom data for your archive.

Can I re-enable the Toolset Blocks and disable the Views or should I keep the Views in order to combine 2 CPT in 1 view?

Views and Blocks are the same plugins. Essentially blocks is views renamed and with the Block editor for views enabled by default. So if you have the Toolset Blocks plugin enabled then you won't need the Views plugin as they are the same.

Thanks,
Shane

#2422687

My issue is resolved now. Thank you!

#2425629

Hi,
Today I opened the archive page that you fixed but the problem with the "looping the same items" remain in every page when I change page by the navigation. All the same items showing up again and again.
Can you please check the archive page again and advise how can I fix this?

#2425779

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

Can you provide the login details again ? They are automatically removed when the ticket is marked as resolved.

Thanks,
Shane