• 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

Header and site title questions.

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 › General Genesis Framework Discussions › Header and site title questions.

This topic is: not resolved

Tagged: genesis_post_title_output, genesis_seo_title, site title

  • This topic has 3 replies, 2 voices, and was last updated 1 month, 2 weeks ago by Brad Dalton.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • December 18, 2022 at 8:02 am #506375
    Gemini55
    Participant

    1.
    In the Header section, I would like to be able to use a logo (header left) AND add an image in the Custom html Header right.
    BUT... I am only able to have the 'Site Title' shown alongside the custom html image. IF I upload a logo to be displayed alongside the custom html image then the logo image doesn't display at all.

    2.
    How can the site title on the homepage have the H1 removed? On all other pages, it IS removed and the H1 is the Page/Post Title and the Site Title is within <p></p> - but on the Homepage, the ‘Site Title’ or logo is H1 – I would like to add a separate H1 for the homepage.
    I have found this code online (to be added to functions./php) but it doesn’t work
    add_filter( ‘genesis_pre_get_option_home_h1_on’, ‘__return_true’ );
    Is anyone able to help?

    https://www.londontheatre1.com
    December 21, 2022 at 3:48 am #506400
    Brad Dalton
    Participant

    1. Please clarify

    2. You can use the genesis_seo_title filter with the is_front_page() conditional tag.

    Example https://gist.github.com/cdils/9002451


    Get Help – Book Consultation.

    December 21, 2022 at 7:15 am #506403
    Gemini55
    Participant

    Thanks Brad, I don't know where the H1 for the Homepage is coming from - all 'internal pages revert to an H2 with the post/page titles being H1.

    This is a Metro P[ro Theme (quite old but I quite like it) on the Genesis Framework.

    I also don't know where this file is genesis-site-title.php as I cannot see it.

    December 22, 2022 at 3:07 am #506409
    Brad Dalton
    Participant

    The filter for the post title is different than the filter for the site title.

    Here's an example however please note, there's other filter hooks for the post title https://gist.github.com/Lego2012/4624f25e7bc0f1f69ec060f5facc61cb

    In genesis > lib > structure > post.php, you'll find this code

    add_action( 'genesis_entry_header', 'genesis_do_post_title' );
    /**
     * 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 3.1.0 Suppress output if “hide title” checkbox is ticked.
     * @since 1.1.0
     *
     * @return void Return early if the filtered trimmed title is an empty string.
     */
    function genesis_do_post_title() {
    
    	if ( ! is_home() && genesis_entry_header_hidden_on_current_page() ) {
    		return;
    	}
    
    	$title = apply_filters( 'genesis_post_title_text', get_the_title() );
    
    	if ( '' === trim( $title ) ) {
    		return;
    	}
    
    	// Link it, if necessary.
    	if ( ! is_singular() && apply_filters( 'genesis_link_post_title', true ) ) {
    		$title = genesis_markup(
    			[
    				'open'    => '',
    				'close'   => '',
    				'content' => $title,
    				'context' => 'entry-title-link',
    				'echo'    => false,
    			]
    		);
    	}
    
    	// Wrap in H1 on singular pages.
    	$wrap = is_singular() ? 'h1' : 'h2';
    
    	// Also, if HTML5 with semantic headings, wrap in H1.
    	$wrap = genesis_get_seo_option( 'semantic_headings' ) ? 'h1' : $wrap;
    
    	// Wrap in H2 on static homepages if Primary Title H1 is set to title or description.
    	if (
    		is_front_page()
    		&& ! is_home()
    		&& genesis_seo_active()
    		&& 'neither' !== genesis_get_seo_option( 'home_h1_on' )
    	) {
    		$wrap = 'h2';
    	}
    
    	/**
    	 * Entry title wrapping element.
    	 *
    	 * The wrapping element for the entry title.
    	 *
    	 * @since 2.2.3
    	 *
    	 * @param string $wrap The wrapping element (h1, h2, p, etc.).
    	 */
    	$wrap = apply_filters( 'genesis_entry_title_wrap', $wrap );
    
    	// Build the output.
    	$output = genesis_markup(
    		[
    			'open'    => "<{$wrap} %s>",
    			'close'   => "</{$wrap}>",
    			'content' => $title,
    			'context' => 'entry-title',
    			'params'  => [
    				'wrap' => $wrap,
    			],
    			'echo'    => false,
    		]
    	);
    
    	echo apply_filters( 'genesis_post_title_output', $output, $wrap, $title ) . "\n"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- title output is left unescaped to accommodate trusted user input. See https://codex.wordpress.org/Function_Reference/the_title#Security_considerations.
    
    }
    

    Get Help – Book Consultation.

  • Author
    Posts
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
Log In

CTA

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

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 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