Selectable Layouts for a single post linked from an archive of the CPTs

I would like to see the CPT use the Wordpress editor (doesn’t have to be Gutenberg), to enter the posts for the CPT. I create CPTs that the client populates and I don’t want them to have to use the Bricks Editor. I want them to have a choice of which layout a page uses to present the Archive or the Single CPT.

Then in the Bricks environment process create and implement these templates:

Archive
Single

Link say the title for an archive CPT post to the presentation of the single post on a page. THEN for that page I have a Field Group with a set of radio buttons that allow the selection of “Style One”, “Style Two”, … and they present on the “Page” for the Single CPT Post linked from the archive. I want to use conditionals to check the style radio button selected and show or hide that element based on the condition.

If it matters, I use ACF and ACF Extended for my CPTs and Field Groups (Layout settings)

I hope I explained well because I could use the help :stuck_out_tongue:

AFAIK - you can’t base a template on an ACF field (except by coding it yourself).
To do what you want with Bricks GUI -
Archive pages: you can create both layouts in one template. Wrap each layout in a div. Then use conditions on the DIV to say ‘show if acf-field=’.
For the post, very similar, but you’re letting them use Blocks/Gutenberg. So you can use ‘post content’ block. Put 2 in, style each as you want, add conditions as before.
If you can, the better option is a single post-content block… then use Gutenberg to create the layout styles using block patterns.

Sorry, I don’t know what AFAIK means :stuck_out_tongue:

Sounds a LOT like what I am doing but things are not working.

One issue for example, if I use the conditional on an element, I must be doing it wrong somehow because then the single post show no data. Then I remove all the elements except one, remove the conditions and still no data on the single post page.

It isn’t making sense to me yet.

I must be on the right track by I am missing some detail.

I am working on a localhost (MAMP) or I would have put it out there already for review. I may have to do that at some point I guess.

Thank you

Perhaps you should look over their docs to make sure you’re doing it right.

Best thing is to start simple, see if it works, and then build on stuff once the basics are right.

Create the template. Go to TEMPLATE settings, and choose where the template should appear. (Edit template->settings->template settings->conditions)
Set it to appear - e.g. - for all posts (post type = posts).
Then add the POST CONTENT block, make sure it’s set to show WORDPRESS content. Save it.
Now visit a post on the front end and see if it works.

If it does, you can now start adding your other elements.

Yeah that’s what I am doing.

:innocent:

I have got the basics working again. Now for the fancy stuff :slight_smile:

Thanks

1 Like