Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@nickcernis
Last active August 24, 2022 18:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nickcernis/eefbdf4a78bccb5364e1e25a9dec64ff to your computer and use it in GitHub Desktop.
Save nickcernis/eefbdf4a78bccb5364e1e25a9dec64ff to your computer and use it in GitHub Desktop.
Set Genesis static homepage site title and entry title heading levels to h1 and h2
<?php
add_filter( 'genesis_entry_title_wrap', 'custom_homepage_title_to_h2' );
/**
* Set page title to h2 on a static homepage if Genesis SEO is not in use.
*
* @param string $wrap The original wrap.
* @return string The new wrap.
*/
function custom_homepage_title_to_h2( $wrap ) {
if ( is_front_page() && ! is_home() && ! genesis_seo_active() ) {
return 'h2';
}
return $wrap;
}
add_filter( 'genesis_site_title_wrap', 'custom_homepage_site_title_to_h1' );
/**
* Set site title to h1 on a static homepage if Genesis SEO is not in use.
*
* @param string $wrap The original wrap.
* @return string The new wrap.
*/
function custom_homepage_site_title_to_h1( $wrap ) {
if ( is_front_page() && ! is_home() && ! genesis_seo_active()) {
return 'h1';
}
return $wrap;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment