Skip to content

Instantly share code, notes, and snippets.

@SeanTOSCD
Last active December 15, 2015 08:09
Show Gist options
  • Save SeanTOSCD/5228767 to your computer and use it in GitHub Desktop.
Save SeanTOSCD/5228767 to your computer and use it in GitHub Desktop.
Building manual header in Volatyl
// Add logo to the header
function header_logo() {
/*
* When manually building a site title (or tagline), you have to consider SEO.
* On the homepage of your site, and other select pages, you'll want your title
* to be wrapped in H1 tags. On other pages, though, like a single post article,
* wrapping your title and tagline in a <span> or <p> is perfectly fine because
* the article title is now the most important headline on the page.
*
* So what this code does is first present a conditional saying:
* "If the page being served has the slug 'home,' 'features,' or 'docs,' wrap
* the site title in an <h1> tag. Otherwise, wrap it in a <p> tag." The <h1> and
* <p> tags are set as the values for the variable $seotitle.
*
* With that being done, the site title is echoed manually with HTML but instead
* of using <h1> or <p>, $seotitle is used so it can change based on the
* conditions specified in the if statement.
*
* This is default behavior in the Volatyl Framework. You only have to do this
* if you are manually building your own header elements.
*
* This example is specific to VolatylThemes.com. Your array values will be diff-
* erent based on your page slugs, post IDs, or whatever you use to target which
* pages need an <h1> title. Visit this URL (halfway down the page... look for red
* text) to see an easy way to target specific pages:
*
* http://volatylthemes.com/headliner-footliner/
*
*/
if ( is_page( array( 'home', 'features', 'docs' ) ) ) {
$seotitle = "h1";
} else {
$seotitle = "p";
}
echo "<$seotitle class=\"site-title\"><a href=\"http://volatylthemes.com\">vol<span>atylthemes</span></a></$seotitle>";
}
add_action('vol_header_top', 'header_logo');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment