• 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

How to Filter genesis_post_title_output

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 › Design Tips and Tricks › How to Filter genesis_post_title_output

This topic is: not resolved

Tagged: filter, genesis_post_title_output, genesis_post_title_text

  • This topic has 2 replies, 2 voices, and was last updated 11 years, 10 months ago by aaronc.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • January 27, 2014 at 9:38 pm #87383
    aaronc
    Member

    Hello all,

    I need to modify the markup of the Entry Titles on my Archive pages. Currently, each Entry Title is wrapped in a <H1> tag; I need to change it to a <H2>.

    I've found the filter genesis_post_title_output (post.php line 203), but can't seem to figure out how to properly implement it as it's a bit different than most other genesis filters.

    /**
     * Echo the title of a post.
     *
     * The genesis_post_title_text filter is applied on the text of the title, while
     * the genesis_post_title_output filter is applied on the echoed markup.
     *
     * @since 1.1.0
     *
     * @return null Returns early if the length of the title string is zero
     */
    function genesis_do_post_title() {
    
    	$title = apply_filters( 'genesis_post_title_text', get_the_title() );
    
    	if ( 0 == strlen( $title ) )
    		return;
    
    	//* Link it, if necessary
    	if ( ! is_singular() && apply_filters( 'genesis_link_post_title', true ) )
    		$title = sprintf( '<a href="%s" title="%s" rel="bookmark">%s</a>', get_permalink(), the_title_attribute( 'echo=0' ), $title );
    
    	//* Wrap in H1 on singular pages
    	$wrap = is_singular() ? 'h1' : 'h2';
    
    	//* Also, if HTML5 with semantic headings, wrap in H1
    	$wrap = genesis_html5() && genesis_get_seo_option( 'semantic_headings' ) ? 'h1' : $wrap;
    
    	//* Build the output
    	$output = genesis_markup( array(
    		'html5'   => "<{$wrap} %s>",
    		'xhtml'   => sprintf( '<%s class="entry-title">%s</%s>', $wrap, $title, $wrap ),
    		'context' => 'entry-title',
    		'echo'    => false,
    	) );
    	
    	$output .= genesis_html5() ? "{$title}</{$wrap}>" : '';
    
    	echo apply_filters( 'genesis_post_title_output', "$output \n" );
    
    }

    How do I go about filtering my entry titles?

    Thanks in advance,
    Aaron

    P.S. I'd also like to add a custom class and additional markup to my Page Titles. How would I use genesis_post_title_output to accomplish this?

    January 28, 2014 at 6:09 am #87470
    mandomat
    Member

    Aaron,
    I am responding because I have been trying to do something like this as well, and am anxious to see what kind of response you get. Thanks for asking this. Matt

    February 17, 2014 at 12:03 pm #90816
    aaronc
    Member

    Matt,

    I haven't been able to find a solid answer to my question, but I thought I'd share this article I found that offers one solution: http://sridharkatakam.com/remove-hyperlinks-post-titles-gensis/

    The solution offered in the article simply includes the entire genesis_do_post_title() function, while removing and customizing the desired bits of code. This doesn't seem like the proper way to use the genesis_post_title_output filter, but it at least works.

    I'm still interested to hear from the StudioPress community on how to properly use the genesis_post_title_output filter entry titles.

    Thanks,
    Aaron

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and 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