Skip Navigation

[Resolved] content template or view (blocks)

This support ticket is created 5 years 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 8 replies, has 2 voices.

Last updated by samuelH 5 years ago.

Assisted by: Nigel.

Author
Posts
#1442321

I need some words of advice.¨

This archive page is presented using a content template: hidden link It´s an archive.

I need to replicate this presentation about 50 times (50 different CPT), but there is no way to duplicate this display as far as I can see. I might be missing some important understanding of how this works in this matter, so I hope you can explain to me how to proceed.

Can I make the same display using view? (blocks), if so - how / where do I start 😉 If not possible, how would you recommend to proceed? Is there a way to export / import this setup, so I can use it on other CPT?

Main site: hidden link
CPT 1: hidden link
CPT 2: hidden link

It will be about 50 CPT, each with their own "archive" display.

#1442413

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Should the archives be identical (displaying the same fields) and the only difference is the post type?

Because you can create a custom archive and assign it to post type A, post type B, post type C, and post type D, in which case the archive doesn't display posts of types A, B, C, and D (which is what would happen if you created a comparable View), it means that when you visit the archive for A the custom archive is used, when you visit the archive for B the custom archive is used, etc. etc.

This works well if the archive output is the same across all the post types, or if there are only minor differences that can be handled with conditional shortcodes (or blocks), such as "only display this field for post type C".

#1442415

Hi Nigel,
Thank you for fast response! Yes, it´s only minor differences (mosty the edit post link - so it triggers the correct post form.

Maybe I have gotten this wrong from the beginning. Would you mind taking a look at the backend to see if I am working with wrong logic?

#1442429
Skjermbilde 2020-01-06 kl. 12.45.37.png

Hi again,
Some more information:

On CPT 1 (hidden link) the edit post button shows, but on CPT 2 (hidden link) the button is not presented.

They are pointing to different edit post forms. If this is solvable, then the one archive will work splendidly.

#1442495

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

I think that is a stumbling block there.

Forms are set to edit posts of one type, you can't have a form to edit posts of any number of types and then, say, pass to the form the kind of post to edit.

So you would need to include separate edit links for every post type in your custom archive and then conditionally display the right one according to the current archive post type, which would be very inefficient as you would be checking the post type 50 times for every result in the archive, e.g. 500 times if you are displaying 10 items per page.

Which means you would really need to create individual custom archives for each. And there is no duplicate function for archives, you have to create each one manually 🙁

Or, don't include the edit link in the archive, only include it when viewing the individual posts...

#1442533

Bollocks, that was truly a gamechanger ;(

But, how about a different approach? Each individual post is presented with it´s title (presented as a number right now). Could this be used as a trigger to the correct form / template? This way I will be able to bypass the use of a edit button?

If this is possible, how should I proceed?

#1442665
Skjermbilde 2020-01-06 kl. 15.36.41.png

Hi again,
I have changed approach, and now the title links to the correct form. Is there a way to make this custom field a button?

#1442825

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

I'm not sure what you've done in that last step, so I can't comment...

#1442827

My issue is resolved now. Thank you!