Community Forums › Forums › General Genesis Framework Discussions › Header and site title questions.
- This topic has 3 replies, 2 voices, and was last updated 1 year, 11 months ago by Brad Dalton.
-
AuthorPosts
-
December 18, 2022 at 8:02 am #506375Gemini55Participant
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.
https://www.londontheatre1.com
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?December 21, 2022 at 3:48 am #506400Brad DaltonParticipant1. 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
December 21, 2022 at 7:15 am #506403Gemini55ParticipantThanks 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 #506409Brad DaltonParticipantThe 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 thegenesis_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. }
-
AuthorPosts
- You must be logged in to reply to this topic.