• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Automatic Tag Archive Headline

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Automatic Tag Archive Headline

This topic is: resolved

Tagged: headline, tag archive, tags

  • This topic has 5 replies, 2 voices, and was last updated 11 years, 10 months ago by Gary Jones.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • August 20, 2013 at 6:53 am #57498
    Brain916
    Member

    Hello,
    Another thing I noticed was in order for Archive Headlines to show up you had to manually place the title of the page on each tag. For my website I have 1000s of tags and would take forever to do this...Is there a way (shown here: http://test.sneakerfiles.com/?tag=nike-kd-vi) for it to automatically show up, whatever the title of the tag is? I know if I want to edit or add to it I need to go in manually though.

    Thanks again for reading.

    http://test.sneakerfiles.com/?tag=nike-kd-vi
    August 21, 2013 at 5:56 am #57875
    Brain916
    Member

    Can anyone please help me with this?

    August 21, 2013 at 6:02 am #57879
    Gary Jones
    Member

    Don't reply to your own posts - it knocks them off of the Unanswered Posts list.

    Try the following in your functions.php file:

    remove_action( 'genesis_before_loop', 'genesis_do_taxonomy_title_description', 15 );
    add_action( 'genesis_before_loop', 'genesis_automatic_term_headline_do_taxonomy_title_description', 15 );
    /**
     * Change the behaviour of the default term headline, by making the default the name of the term.
     *
     * If the headline has been customised in some way, hen this will show instead.
     *
     * @author Gary Jones, Gamajo Tech
     *
     * @return null Return early if not the correct archive page, not page one, or no term meta is set.
     */
    function genesis_automatic_term_headline_do_taxonomy_title_description() {
    
    	global $wp_query;
    
    	if ( ! is_category() && ! is_tag() && ! is_tax() )
    		return;
    
    	if ( get_query_var( 'paged' ) >= 2 )
    		return;
    
    	$term = is_tax() ? get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ) : $wp_query->get_queried_object();
    
    	if ( ! $term || ! isset( $term->meta ) )
    		return;
    
    	$headline_text = $term->meta['headline'] ? $term->meta['headline'] : $term->name;
    
    	$headline = sprintf( '<h1 class="archive-title">%s</h1>', strip_tags( $headline_text ) );
    
    	$intro_text = $term->meta['intro_text'] ? apply_filters( 'genesis_term_intro_text_output', $term->meta['intro_text'] ) : '';
    
    	printf( '<div class="archive-description taxonomy-description">%s</div>', $headline . $intro_text );
    
    }
    

    I'll turn it into a plugin later on.


    WordPress Engineer, and key contributor the Genesis Framework | @GaryJ

    August 21, 2013 at 6:40 am #57893
    Gary Jones
    Member

    Plugin now created: https://github.com/GaryJones/genesis-automatic-term-headline


    WordPress Engineer, and key contributor the Genesis Framework | @GaryJ

    August 22, 2013 at 4:08 am #58152
    Brain916
    Member

    This worked perfectly! I dropped it into the functions.php instead of using the plugin. Thank you so much, you are awesome my friend!

    August 22, 2013 at 4:40 am #58154
    Gary Jones
    Member

    The trouble with not using the plugin, is that should you ever change themes, that headline content is going to disappear. With a plugin however, it will persist, and could also be used across other sites as well. There's no disadvantage to using the plugin here.


    WordPress Engineer, and key contributor the Genesis Framework | @GaryJ

  • Author
    Posts
Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Automatic Tag Archive Headline’ is closed to new replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble