Automatically display titles on Category and Tag Archives

Screen Shot 2014-07-04 at 12.58.11 PM

The archive pages in Genesis can be a bit confusing. Other than the URL (and breadcrumbs if you have them turned on), they look exactly the same as the main blog.

Genesis provides a useful feature for adding headlines and intro text to the top of your archive pages. Go to Posts > Categories and edit a category to see the screenshot above. But this requires you to manually type it in for each category. If you have a lot of categories this can be a hassle.

Add this code to your theme’s functions.php to automatically default that field to your category name. If you provide an “Archive Headline” when editing a category, that is used. But if you don’t, the category name is used.

This applies to categories, tags, and any custom taxonomies you’ve created.


  1. says

    I’ll second Craig’s comment, a very nice bit of code, so many of which you offer here.

    This comes up as a forum question sometimes, and now there’s a place to send them. :)


  2. says

    I’m always so impressed by the elegance of your solutions! I’ve added titles to archives several times in the past by putting code to retrieve and output the term into the appropriate template file, completely overlooking the built-in headline functionality. I’ll definitely be adding this into my base child theme for future use. Thanks Bill Erickson!

  3. Victor Marsala says

    I have a general question in terms of your approach to client edits.

    I have more and more clients that want to handle creating their own content and maintaining it, and while the days of pasted-in Microsoft Word headaches are nearly over, it seems counterintuitive to think just how few people know anything about HTML or how it works, or listen when provided with a few pieces of information relevant to get the job done.

    If someone wants a video gallery, rather than make them copy and paste divs and headers and URLs, I’ve sometimes just done it WerkPress style and made a custom post type for videos and told them each video “post” is aggregated on the gallery page. And that’s fine.

    But recently I keep having things like someone who wants a simple schedule, where you click the times and it reveals in a jQuery slideToggle what takes place at that time. I say just copy and paste the two lines, and edit the text of it for the bold and non-bold bits, and the script will do the rest.

    It seems like overkill to make an entire post for two lines of text, so I don’t want to do that to them, but if they edit the text in the Visual tab, WordPress can mess with the formatting, and if they copy and paste in the Text tab, I’ve seen three different ways the formatting can be broken at the same time on the same page. Even something as simple as getting the nesting wrong can be disastrous.

    The themes run great (thanks, Genesis) and the actual custom coding and scripting are effective at what they do. But without some protected way of editing specific areas (almost like Publisher, or vaguely like Photoshop layers) I don’t know how to save them from themselves. Do you just make redundant code that tries to sniff out every possible break? It seems awkward and limited.

    • Bill Erickson says

      I make extensive use of custom metaboxes. My goal is for clients to never see (or need to know) HTML. So if there’s anything that can’t be done easily through the visual editor, I’ll build a metabox for the client to manage it.

      For instance, here’s a page on a client site, and here’s what the backend looks like to manage it:

      • Victor Marsala says

        Wow, that’s an interesting take! A lot going on, but highly organized. My first thought was “How does it fit for a schedule scenario,” but the whole idea of a schedule is that everything’s fixed, and the only things they should be editing anyway are time ranges and descriptions, not how many entries there are.

        Thanks for the feedback. You’re always so professional and generous with what you share and I hope nothing but continued success for you. Thanks for your positive contributions to both WP and Genesis and their respective communities!

  4. says


    Thanks for writing this up.

    Here’s the possibly-slap-my-forehead question for you.

    Why does Genesis include the extra “Archive Headline” and “Archive Intro Text” on category & tag pages when WordPress already supplies the “Name” and “Description” fields? For our Genesis theme, long ago I added code to the functions file to simply write the WordPress “Name” and “Description” on category & tag pages, due to this confusion you speak of.

    Thank you.

    • Bill Erickson says

      I’m not sure why Genesis creates its own fields. My guess is so that you could have a title that’s different than the category name. So the category might be “News” and your archive title is “News about Company XYZ”. Alternatively, you might add descriptions to your categories to be used in the backend or in mega menus, but not want them displayed at the top of the archive pages.

      I think the simplest answer is that by providing additional fields, Genesis doesn’t have to assume how you want things structured. I prefer the “Decisions, not Options” approach personally.

  5. Mario says

    Thank you very much for sharing this. How should I modify the code to be able to show also the archive intro text for each category automatically?

  6. Mario says

    Thanks Bill, you’re amazing. Sorry if I ask it here: have you already made one of your beatifully neat snippets for managing sidebars and menus? I’ve been using the plugins “Simple Sidebars” and “Simple Menus”, but they seems to be able to modify only the pages created by the user, while I need to dynamically change also the sidebars and menus displayed in 404, archives and not found pages.

      • Mario says

        I see, so the only way is to do it manually… I’ve added your code and it works like a charm, but my sidebar is now empty obviously. Could you please tell me also how to add widgets to it? I hope I’m not bothering you too much with my questions.

        • Bill Erickson says

          That code creates a sidebar called “Archive Sidebar”, so go to Appearance > Widgets and add widgets to the Archive Sidebar.

          • Mario says

            I just realized why I couldn’t see the sidebar in Appearance; I had to add a piace of code to the register_sidebar including the name of my theme. Which is the Is_function() for applying it also to search pages with results and not found search pages? Again, thank you for everything, I’m very satisfied.

  7. Mario says

    How can I make a search form like yours in Genesis 2.x ? I mean with the button inside the search bar with a lens image.

      • Mario says

        I’ve already tryed it, and before it, even the Yoast one made by you. It seems that there is something wrong because Genesis Framework forces the text “Search” in the submit, so I cannot achieve the result that I want because the submit size cannot be less than the font size of it (or that’s what I assumed).

        Have a look at the problem, please:

        • Bill Erickson says

          Add this to your functions.php file:

          add_filter( ‘genesis_search_button_text’, ‘__return_false’ );

          Genesis adds text to the search field and the submit field, but these are both filterable.

          • Mario says

            Just added your snippet but the result is quite the same. I even used your exact same image and style, so I can’t see where is the problem. Anyway, it seems to work fine now for sizes bigger than 48x32px, really strange thing… Is it maybe declared as minimum size somewhere?

  8. Mario says

    Ok, I’ve found the problem… There was a padding overwriting another padding around in the code. It works even keeping the value attribute now, thank you.

  9. Mario says

    Ok, now I have another problem… I had to change the padding in input [type=”submit”] to 0 to fix the problem of the area around the button, but now the “Post Comment” button, being also it an input submit, has no more padding… Which is the best way to solve this in your opinion? The only idea that came into my mind is using width and height instead of padding.

  10. says

    Hey Bill,

    Thanks for the great snippet. I would love to see an all inclusive solution that covers Author and Date archives as well (along with any other conceivable archive). Any ideas?

    Seems like the genesis_term_meta_headline filter only works for taxonomy terms, and I can’t seem to find a good filter to hook into for the author title, which simply relies on:
    $headline = get_the_author_meta( ‘headline’, (int) get_query_var( ‘author’ ) );

    For some reason, the author intro text is passed through a filter (I wonder why the author headline isn’t):
    $intro_text = $intro_text ? apply_filters( ‘genesis_author_intro_text_output’, $intro_text ) : ”;

    Problem with this code is that if $intro_text is blank, you’re still going to get ”, regardless of what you try to do with that filter. It should definitely be filtering before checking for a non-empty value, no? Am I missing something?

    Same goes for date archives – I can’t seem to find any code for outputting a title for these archives. Is that so?

    It seems like it might be helpful if ALL primary / page title output was wrapped in a common filter, including titles on the various archive pages. This would allow for much simpler modifications across the board (e.g. adding an icon before each page title or writing one function with a bunch of conditionals that can easily set default titles for ALL different types of archives).

    Is this doable in another way? Would love your feedback.

    Thanks again for the awesome snippet!

    • Bill Erickson says

      The author archive typically has the author box displayed at the top, if that user has checked “display author box” on their profile. You can automatically display this (as if all authors had already checked that) using this code: One is for displaying the author box on author archives, the other is to display at the bottom of posts.

      You’d need to write your own for date archives. This will work:

      • says

        Fantastic, thanks Bill! Any issues you can foresee were I to create an “Automatic Archive Titles” plugin that combines all three methods? Are there other archives you know of that would need including (right now it’s term, date, author)? Other thoughts?

        Thanks again for the great snippets.

        • Bill Erickson says

          Well the term and author ones I shared would only work in Genesis. And you might want to create a settings page where people could turn them on/off (ex: none of the authors have filled out bios, so lets not turn on author archive intros). But other than that, you’re good!

  11. Mario says

    Yeah, I solved it doing so. :) I couldn’t understand the situation because of input, input[type=”submit”] and .search-form input[type=”submit”].

    I can’t find any snippets for removing this annoying label: Comment
    So many guides on the Net for removing or customizing name ,email and url but not this one. How did you manage to remove it in your comment form?

    • Bill Erickson says

      In the HTML4 version of Genesis (which is what I’m still using), Genesis had its own comment form arguments and didn’t include a label for comments. The HTML5 version uses WordPress’ default comment form settings which does.

      Look at /genesis/lib/structure/comments.php, genesis_comment_form_args() to see how it’s being filtered for HTML4. All that’s relevant to you is the ‘comment_field’ property.

      • Mario says

        I found it… So, the only way is to create an own HTML5 comment_form using php instead of the one used by default for WordPress, right? I will keep it then… When I tryed to move the elements using CSS, I couldn’t get a proper result, even though the code alone was right and working, I don’t know why.
        Anyway, the bad thing of the WordPress comment_form is that it takes too much space to display vertically, which I don’t like honestly. Is it possible they will change it in the future?

        • Bill Erickson says

          No, you don’t have to rebuild the whole form. The filter I showed you lets you modify just the ‘comment_field’, which is the textarea for the comment and its label.

          You could also just hide it with CSS.

  12. Mario says

    Is there a remove_action for comment_author_says_text? Using __return_false there is still the span class and I don’t want to touch Genesis core files.

    • Bill Erickson says

      You’ll need to completely rebuild the comment output. Filter ‘be_comment_list_args’, change the callback to a function you create. Copy the callback in /genesis/lib/functions/comments.php as a good starting place.

      Although you bring up a good point. I’ll post that as an internal Genesis issue and hopefully the next version will check to see if there’s a value for “says” before outputting the markup.

  13. Mario says

    Is there a way to manually rearrange the cropped part shown as featured/grid image? I mean, sometimes you put an image and it automatically shows the middle part of it while you wanted the top one and so on. I would need to have 3 different sizes: featured image, featured grid and featured sidebar, of which I care just of width size that must be the one defined by me, and the other size to show in the height I would need to be able to manually fix it If I don’t like the default one shown.

    • Bill Erickson says

      Use my Image Override plugin. It allows you to upload an image for a specific image size rather than using the one WP generates. Just make sure you crop it to the right dimensions, because WordPress won’t scale and crop it for you (by design).

      • Mario says

        This is amazing! Just one questione: why it says “this image should be EXACTLY” for every size except large and medium?

        • Bill Erickson says

          Image sizes can either be hard crop, where the image is scaled down and then cropped to those exact dimensions, or they are soft cropped, where the image is scaled down to fit within those dimensions.

          The “exactly” means that image size is a hard crop.

  14. Mario says

    Do you recommend me to register new image sizes or replace the already existing “thumbnail”, “medium” and “large”? I think it would be better to unregister the WordPress ones and use mine, but I don’t know if it’s possible actually.

    Another strange thing I’ve noticed is that the featured image is shown in front-page/archive inside my content, just after the post-info (which is exactly what I want), while in the singular post it is displayed between the title and post info, and in original size, not the one defined by me. So, how can I tell Genesis to move it in my content (the default position, under the post info) also in my singular posts and to use my-cropped-size for it? The problem could be summarised in: “I want my featured images to look the same everywhere”. Thank you in advance man.

    • Bill Erickson says

      You can create a new image size if you need it, but I recommend using the three built-in ones first. WordPress will generate an image for every image size you have. So if you have the three built-in image sizes, you’ll have 4x the images you upload (original + 3 image sizes). Each additional image size will drastically increase the space used on your server, since every single image uploaded will also be generated at that size too.

      Genesis does not display an image on single posts/pages. It only displays it on archive pages. You can select which is used in Genesis > Theme Settings. My guess is your theme is adding an image on single posts, so look in single.php or functions.php to adjust it.

      • Mario says

        Actually you’re right, indeed I had a snippet in my functions.php. But what if I want my featured image to show also in my single posts? Would it be better to use an attachment every single time or put a snippet in functions.php telling Genesis to generate it in the right size, like for the archive? Maybe for a SEO purpose an attached image is more considerated, I don’t know.

  15. Mario says

    UPDATE: I tryed your “Image Override” plugin, but doesn’t seem to work. I upload the image, but it is stored as separated item and doesn’t actually replace the size chosen by me. Maybe it is due to new versions of WordPress.

    • Bill Erickson says

      I’ve tried it in the latest version of WordPress and there is no issues. The only possible source of your issue (that I can think of) is your theme isn’t actually calling the image size you are specifying. If you are overriding ‘medium’, your theme needs to be doing get_post_thumbnail( get_the_ID(), ‘medium’ ).

      You’ll need to troubleshoot the issue on your own as I don’t provide support for my plugins. But if uploading images directly to your uploads folder works for you, go for it. Just remember not to regenerate thumbnails.

      • Mario says

        Because your plugin is able also to keep the images uploaded by you manually even when you regenerate thumbnails?

        Anyway, could you please reply to the previous message on how to tell Genesis to use my size for the featured image and how to move it in the content, please?

        • Bill Erickson says

          I’m not sure what you’re asking about, regarding “attached images”. If you want the image to appear on single posts you’ll need to add code to functions.php or single.php to display it.

          I’m sorry, but these questions are no longer relevant to this post. I don’t typically provide this much free support. If you have more general Genesis questions, I recommend you post them in the Genesis support forums.

  16. Jeremy says

    Hi Bill, thanks for this helpful post! Can you tell me if there is any way to make the Archive Headline (and optionally Intro Text) appear at the top of every archive subpage too? (I mean /page/2/ and so on). Currently the subpages don’t have any heading at all – they just list the posts for that page, which can be confusing from a navigational point-of-view.

    At a minimum I’d love to just have the Archive Headline (via H1 tag) and the Intro Text displayed at the top of every subpage (identical to how it’s displayed at the top of the first page). But even better would be to make the heading specific to each subpage, like: “Category Name – page 3 of 8” – which is exactly how my HTML title tag looks anyway, due to using the WP SEO plugin which customises the title tag this way.

    Is there any function which can accomplish this? I haven’t been able to find a solution yet.

    • Bill Erickson says

      The archive intro Genesis provides is hardcoded to only work on the first page. If you look in /genesis/lib/structure/archive.php, line 39-40 is this:

      if ( get_query_var( ‘paged’ ) >= 2 )

      You’ll want to unhook the Genesis archive:

      remove_action( ‘genesis_before_loop’, ‘genesis_do_taxonomy_title_description’, 15 );

      Then build your own that functions as you like. You could copy that one as a guide, or build from scratch.

      • Jeremy says

        Thanks Bill, that was very helpful! I’ve now been able to make a new function based on the existing one, which adds the heading to every other archive page. Works great!

        Do you know why Genesis restricts the heading to just the first page, in the first place? Is there any particular reason for that, eg. SEO or something? I’ve read that some of the stock WP themes, eg. Twenty Eleven etc, show the heading on every archive page. So it puzzles me why Genesis specifically blocks that. Do you have any opinion about it yourself – advise for or against? :)

        • Bill Erickson says

          I think it is so that you don’t have the same h1 on multiple archive pages. But if you’re including a page number in there it shouldn’t be a problem.

          • Jeremy says

            Oh – and is it a problem if I *do* have the same h1 on multiple pages?

            What I’ve done in the end, is indeed to keep the h1 heading identical on every archive page – it was simpler that way. But the page *content* is obviously different, and each page also shows the pagination numbers to indicate which page you’re currently on. Surely that’s not a problem?

            I read a post from Google where they talk about “Demystifying the duplicate content penalty”( which seems to suggest that duplicate headings isn’t a problem? What do you think?

          • Jeremy says

            …I should also add that I have set all of my archive subpages to noindex, via Joust’s WordPress SEO plugin. So only the first page should be indexed anyway.

          • Bill Erickson says

            I’m not an SEO expert so I cannot provide guidance. I think you’ll be fine since they are noindex anyway.

  17. Alex says

    Thank you,

    I use Eleven40 PRO theme and have had a problem naming TAG archive. With “Category” all was OK. With this add to theme function.php my problems are solved. Thank you !

  18. Alexandra Spalato says

    my client need to have the headline and the description, so i try to have the 2 snippets in my function, but i get a php error
    function be_default_category_title($headline, $term ) {
    if( ( is_category() || is_tag() || is_tax() ) && empty( $headline ) )
    $headline = $term->name;

    return $headline ;

    add_filter( ‘genesis_term_meta_headline’, ‘be_default_category_title’, 10, 3 );

    function be_default_term_description( $desc, $term ) {
    if( ( is_category() || is_tag() || is_tax() ) && empty( $desc ) )
    $desc = $term->description;

    return $desc;
    add_filter( ‘genesis_term_meta_intro_text’, ‘be_default_term_description’ );

    Also , i would like to know where is this filter genesis_term_meta_headline , serach in the genesis code and don’t find it

  19. Alexandra Spalato says

    I have actually solved the problem, and there is an error in the second snippet, as it miss the arguments

    so this is my complete code ant it works :-)

    function be_default_category_title($headline, $term ) {
    if( ( is_category() || is_tag() || is_tax() ) && empty( $headline ) )
    $headline = $term->name;

    return $headline ;

    add_filter( ‘genesis_term_meta_headline’, ‘be_default_category_title’, 10, 2 );

    function be_default_term_description( $desc, $term ) {
    if( ( is_category() || is_tag() || is_tax() ) && empty( $desc ) )
    $desc = $term->description;

    return $desc;
    add_filter( ‘genesis_term_meta_intro_text’, ‘be_default_term_description’, 10, 2 );

    As my client also wanted the description wrapped in h5 instead of p

    i add this filter

    as it take me sometimes to figure it out, i paste it here so it can be usefull for others 😉

    add_filter(‘genesis_term_intro_text_output’ , ‘wst_wrap_intro_text’);
    function wst_wrap_intro_text() {
    global $wp_query;
    $term = is_tax() ? get_term_by( ‘slug’, get_query_var( ‘term’ ), get_query_var( ‘taxonomy’ ) ) : $wp_query->get_queried_object();
    $intro_text = sprintf( ‘%s’, strip_tags( $term->meta[‘intro_text’] ) );
    return $intro_text;


  20. Erik D. Slater says

    The problem with using the “Archive” Headline and Intro Text fields – compared to using the regular Name and Description fields – is that you can’t export the data … unless I missed something … which is quite possible.

    • Bill Erickson says

      That’s a good point. But if you use the approach outlined in the article above (using the category name for “Headline”) and duplicate it for the intro text (use description for “Intro text”), you solve that problem.

      You store the information in Name/Description which is core WP functionality (no need to migrate data), and you leverage Genesis’ built-in functionality for displaying an archive intro using that data.

      • Erik D. Slater says

        Yep, that’s exactly what I did … for both name and description :-)

        Otherwise, you end up having to fiddle around with the genesis-term-meta entry in the options table … which I tried out for fun … and which works … but it’s just not terribly satisfying … even if it is good to know :-)

        The nice thing about the snippet is that it still takes the Archive details if you fill them in … if that’s something someone wanted to do.

  21. says

    Hey! Thank you for this nice snippet. What do you think about to remove the class=”archive-title”?
    I think Title is cleaner and maybe google like it more? Do you know how to remove class?
    Thank you again and nice website! :-)

Leave A Reply