What's the best way to get a tag.php template done for the child theme?

Which template should I start from to best get a tag.php template done?

Or did I miss something in the existing features again? :slight_smile:

Hey Nomad411,

I have already assigned another member of the team to assist you with your inquiry.

Ben

Hi Gerard,

The index.php file in the theme is what generates the generic blog/archive layout. You can copy that and rename it tag.php. Let me know if you have any questions.

Justin

oh?? I was looking through all the single and content and everything else. :slight_smile:

Cheers

The content.php file contains the code for each individual post in an archive layout. If you need to customize that, you can copy it and name it content-tag.php. Then you’ll need to replace this line in tag.php…

<?php get_template_part('content', get_post_format()); ?>

with this…

<?php get_template_part('content-tag', get_post_format()); ?>

Justin

Ok, I see.

I’ll give that a go then,

thanks

THAT, was too easy :slight_smile:

I’m presuming that CATEGORY works the same so off to check that now :slight_smile:

Thanks.

You are correct! :slight_smile:

Here’s a detailed post on how all of that works…

https://codex.wordpress.org/Template_Hierarchy

Here’s an image that shows the template hierarchy…

https://codex.wordpress.org/images/9/96/wp-template-hierarchy.jpg

Justin

Yep yep!

I’ve been hesitant to edit templates so far, as you might have changes to the theme in the future, but I’ll try to keep track of them I guess.

I’m sure that BB will someday let us edit a wider range of default pages :slight_smile:

Hi Gerard,

As long as you make these changes in a child theme, you shouldn’t have to worry about updates. Yes, we would love that functionality someday as well :slight_smile:

Justin