Skip to content

Instantly share code, notes, and snippets.

@generatepress
Last active May 14, 2016 22:58
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 generatepress/26f526b9693c437d793e to your computer and use it in GitHub Desktop.
Save generatepress/26f526b9693c437d793e to your computer and use it in GitHub Desktop.
Rearrange header so site title is on top, with the logo next and then the tagline
<?php
if ( ! function_exists( 'generate_header_items' ) ) :
/**
* Build the header
*
* Wrapping this into a function allows us to customize the order in a child theme
*
* @since 1.2.9.7
*/
function generate_header_items()
{
$generate_settings = wp_parse_args(
get_option( 'generate_settings', array() ),
generate_get_defaults()
);
// Get the title and tagline
$title = get_bloginfo( 'title' );
$tagline = get_bloginfo( 'description' );
// If the disable title checkbox is checked, or the title field is empty, return true
$disable_title = ( '1' == $generate_settings[ 'hide_title' ] || '' == $title ) ? true : false;
// If the disable tagline checkbox is checked, or the tagline field is empty, return true
$disable_tagline = ( '1' == $generate_settings[ 'hide_tagline' ] || '' == $tagline ) ? true : false;
// Header widget
if ( is_active_sidebar('header') ) : ?>
<div class="header-widget">
<?php dynamic_sidebar( 'header' ); ?>
</div>
<?php endif;
// Site title
if ( false == $disable_title ) : ?>
<div class="site-branding">
<?php if ( false == $disable_title ) : ?>
<p class="main-title" itemprop="headline"><a href="<?php echo apply_filters( 'generate_site_title_href', esc_url( home_url( '/' ) ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p>
<?php endif; ?>
</div>
<?php endif;
// Site logo
generate_construct_logo();
// Site tagline
if ( false == $disable_tagline ) : ?>
<div class="site-branding">
<?php if ( false == $disable_tagline ) : ?>
<p class="site-description"><?php echo html_entity_decode( bloginfo( 'description' ) ); ?></p>
<?php endif; ?>
</div>
<?php endif;
}
endif;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment