Archived topic
Can WP Show Posts be used on category archive page?
3 replies · Started by Greg on June 16, 2021
I have a WP Show Posts item to list blog posts here: https://juneswift.com/journal/
Can I use the same format to display posts on the category archive pages here: https://juneswift.com/category/infrastructure/ ?
Hi Greg,
To clarify: You want to change the post loop of the theme from default query to WP Show Posts list?
If so, you can do this but this will require a bit of coding and the use of child theme templates.
You'll have to create a child theme template for the archive pages. We then replace the loop part of the post to this:
$queriedArchive = get_queried_object();
$settings = array(
'taxonomy' => $queriedArchive->taxonomy,
'tax_term' => $queriedArchive->slug,
);
wpsp_display( 1234, $settings );
Where 1234 is the WPSP list you're going to use as the template.
What this does is, it basically turns the WPSP 1234 specified into the template for the post listing for archive pages.
I already have a child theme of the default generatepress pro theme. What part am I going to replace? I've made a copy of the generatepress/archive.php file into my child theme. Do I replace lines 36-42?
while ( have_posts() ) :
the_post();
generate_do_template_part( 'archive' );
endwhile;
Hi there,
you can use a Block Element - Type: Content Template to build design the posts on the theme archives:
https://docs.generatepress.com/article/block-element-content-template/
The columns will need to be defined in the Customizer > Layout > Blog.