So the client wants to display post categories separately with different headers. I need to copy the existing blog template that is used for archive pages and add code that just selects the category posts that I need displayed. I found the basic code i need to loop through posts and display categories. I think if you can help me identify the page template I need to copy and modify that I should be able to figure out the rest.
So I am using PRO - and the Integrity Stack. I have created a News Category page that displays "news" category posts with a custom header. I think I what I really need to do is create actual page templates for each different category that include the header to display. I need to do this for posts categorized as "Blog" and posts categorized as "Events".
SO what I am thinking is if you can tell me what php templates are being used - I can copy them and alter the code then save them as custom templates. Then create new pages and assign each of them the appropriate template. But which templates should I be using AND where should I be placing the new templates (what directory- and should this be in the child theme) so that they can be referenced correctly?
Appreciate any guidance/help you can give. This is a challenge for me but one I need to figure out.
The basic code I was going to use is below:
* Template Name: Category Custom Page
$args = array(
'post_type' => 'post',
'post_status' => 'publish',
'category_name' => 'CATEGORY',
'posts_per_page' => 5,
$arr_posts = new WP_Query( $args );
if ( $arr_posts->have_posts() ) :
while ( $arr_posts->have_posts() ) :
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
if ( has_post_thumbnail() ) :
<h1 class="entry-title"><?php the_title(); ?></h1>
<?php the_excerpt(); ?>
<a href="<?php the_permalink(); ?>">Read More</a>