Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Overwrite our GP header so you can change the order of elements. Note: This will only work in GeneratePress 1.2.9.7 and beyond.
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 and tagline
if ( false == $disable_title || false == $disable_tagline ) : ?>
<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;
if ( false == $disable_tagline ) : ?>
<p class="site-description"><?php echo html_entity_decode( bloginfo( 'description' ) ); ?></p>
<?php endif; ?>
</div>
<?php endif;
// Site logo
if ( ! empty( $generate_settings['logo'] ) ) : ?>
<div class="site-logo">
<a href="<?php echo apply_filters( 'generate_logo_href' , esc_url( home_url( '/' ) ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><img class="header-image" src="<?php echo esc_url( $generate_settings['logo'] ); ?>" alt="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" /></a>
</div>
<?php endif;
}
endif;
@rajuodedara006

This comment has been minimized.

Copy link

@rajuodedara006 rajuodedara006 commented Sep 21, 2019

I'm using generate press pro with event calendar pro and used generate press elements to set header and set

{{post_title}}

in that to show title but in single events page it always shows only venue title and that is also just one venue for all single posts.

Could you please me on that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment