Site logo

Archived topic

Support for Wordpress 4.5.2

5 replies · Started by Ryan on May 10, 2016

Viewing posts 1–6 of 6

I've just upgraded the GP theme, premium addons and also the Wordpress core. I was trying to figure out an issue why when I clicked on "Edit original" in the wordpress image editor it was not showing a thumbnail of the image (was showing broken image graphic). After upgrading it finally advised me what I had suspected - the server does not support the feature.

However, I have broken some functions.php customisations that I made to the header in my child theme. Can you help me out Tom? The code below does not appear to work anymore and on my site all I have is a blank header:

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 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="/wp-content/uploads/2016/03/Queensland-Government.svg" onerror="this.src='/wp-content/uploads/2016/03/QG-mono.gif'; this.onerror=null;" alt="Queensland Government" title="Queensland Government" />
<!-- Child theme customisation to insert TMR text graphic (can't do in customizer) -->
   <img class="tmr-title" src="/wp-content/uploads/2016/03/Main-Roads-Title_navy.svg" onerror="this.src='/wp-content/uploads/2016/03/Main-Roads-Title_navy.gif'; this.onerror=null;" alt="Department of Transport and Main Roads Blog" />
		</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;
}

I don't want to retrograde the core wordpress install back to version 4.4.2 if I can help it.

I just retrograded everything back to the way it was, including:
Wordpress Core
GP Theme
GP Premium plugins

Now I still find that my header is completely gone and I think it has to do with the custom php script in the child theme functions.php file.

I'm quite sure that this PHP code in the functions.php file is the issue:

	if ( is_active_sidebar('header') ) : ?>
		<div class="header-widget">
			<?php dynamic_sidebar( 'header' ); ?>
		</div>
	<?php end

Can you please assist?

Lightbulb.

My child theme functions.php script was too smart for me, the person who created it.
When I did upgrade the theme, I think i lost the uploaded logo on the site identity section within the Customiser.

There needs to be an image here for my script to actually function.
All good now.

Your function should be like this:

if ( ! function_exists( 'generate_header_items' ) ) :
/**
 * Build the header
 *
 * Wrapping this into a function allows us to customize the order
 *
 * @since 1.2.9.7
 */
function generate_header_items() 
{
	// Header widget
	generate_construct_header_widget();
	
	// Site title and tagline
	generate_construct_site_title();
	
	// Site logo
	generate_construct_logo();
}
endif;

Then rearrange those elements as you need.

WordPress 4.5 has a custom logo feature which GP is using, so you need to use the function above to display the logo (that function displays it using the new feature with the old setting as a backup).

Thanks Tom. Will keep this in mind for when I do upgrade.
I've learnt to do it on a WAMP install first next time around :o

Always good to check the changelog as well :)

This archived topic is closed to new replies.