Site logo

Archived topic

CPT and Taxonomies - how to build archive-pages?

5 replies · Started by Mario on June 14, 2021

Viewing posts 1–6 of 6

Hello!
In the next few months, I will change my present pagebuilder because of speed problems. I already got GPP (GeneratePress Premium) and GBP (GenerateBlocks Pro). Because I am new to Gutenberg, the start was a little bumpy. Anyway, I have successfully created the first pages and I am pleased with the speed increase (I get a 100 for the new homepage, which is visually an exact copy of the current one and despite all the optimizations only yields an 85).
I develop all under a replacement URL in maintenance mode. When everything is ready, I will move the site to the correct URL.
Sorry for the long introduction, but this is where I am at right now. From here I need help.

I have some sort of glossary that I have built as a custom post type. This CPT has a special permalink structure which must be maintained at all costs. Because of that I wrote some lines in PHP in my functions.php (GeneratePress child theme) – works like a charm.
Examples
`<li>url/cpt-glossar/taxonomy-term1/taxonomy-term2/the-post/</li>
<li>url/cpt-glossar/taxonomy-term1/taxonomy-term2/taxonomy-term3/the-post/</li>`
you get the idea.

You guessed it - I now need archive pages for the cpt-glossary itself (with all entries/posts), so also for the respective taxonomies. I have no idea, where to start or how to archive this with Gutenberg, GPP and GBP.
To give you an idea, how this works right now, visit my current one. This is my current glossar-site, and it shows, what I would like to archive.

I hope, it will be possible. Take your time to answer.

Hi there,

thanks for the great feedback - really good to hear this!

When you registered your CPT - one of the arguments is has_archive, https://developer.wordpress.org/reference/functions/register_post_type/#has_archive

With that argument, if there is no specific CPT Archive template present then WP will select the themes archive.php.
Which should allow you to create the card design using the GB Element, with a Display Rules spercific to your CPT.

Hello David, thank you for showing me the way.

Using Elements have implemented the following things:
- Layout for archive (CPT and Taxonomy): Content (no sidebar).
- Block - Hook (generate_inside_site_container): header, background image - both for CPT and Taxonomy

Furthermore I implemented individual image sizes in the Gutenberg editor (via functions.php).
All this works fine and is done.

What I don't understand yet:
At the moment the featured images are displayed full size below each other. Which is to be expected with a full width layout. How can I develop and display the cards here in three (desktop) rows, two rows (tablet) and one row (mobile) respectively? Of course I don't want to use the full image size for this either, but an adjusted one.

David, again - thank you!
I have achieved everything as desired.

Glad to be of help!

This archived topic is closed to new replies.