Names of templates to edit

Hi there

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:

<?php /** * 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() ) :
    $arr_posts->the_post();
    ?>
    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
        <?php
        if ( has_post_thumbnail() ) :
            the_post_thumbnail();
        endif;
        ?>
        <header class="entry-header">
            <h1 class="entry-title"><?php the_title(); ?></h1>
        </header>
        <div class="entry-content">
            <?php the_excerpt(); ?>
            <a href="<?php the_permalink(); ?>">Read More</a>
        </div>
    </article>
    <?php
endwhile;

endif;

Hi Stacey,

Thank you for writing in, regretfully, this particular customization request is outside the scope of our support as this is not related to an issue with the theme and instead has to do with your customization of it. As such, you will need to investigate this particular issue on your own or seek help from a developer should you not feel comfortable making these changes yourself.

What you need to do is create a custom category template, and have that template a different header per category. Or create a separate template for each category.

Category Templates

Thank you for your understanding.

I am not sure I understand. I am not asking you to customize anything. I just need to know the name of the templates that are being used to handle the blog single posts and the blog archive posts?

Hi There,

The template for the single post is:

x/framework/views/{your-stack}/wp-single.php

The template for the blog & category archive is:

x/framework/views/{your-stack}/wp-index.php

To override these files, you need to setup a child theme:

https://theme.co/apex/forum/t/setup-how-to-setup-child-themes/57

For more information about the Customizations Best Practices, please take a look at this:

Hope it helps :slight_smile:

thank you! Appreciate it!

Actually, can you tell me what php page handles the category or archive display? I cant find that in the files.

Hi There,

The category and archive pages are still using the x/framework/views/{your-stack}/wp-index.php file as the template.

If you want to use the different layout for these pages, please create 2 new files in your child theme directory:

  • x-child/archive.php
  • x-child/category.php
<?php

// =============================================================================
// VIEWS/INTEGRITY/WP-INDEX.PHP
// -----------------------------------------------------------------------------
// Index page output for Integrity.
// =============================================================================

get_header();

?>

  <div class="x-container max width offset">
    <div class="<?php x_main_content_class(); ?>" role="main">

      <?php x_get_view( 'global', '_index' ); ?>

    </div>

    <?php get_sidebar(); ?>

  </div>

<?php get_footer(); ?>

Hope it helps :slight_smile:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.