- This topic has 13 replies, 3 voices, and was last updated 7 years, 11 months ago by Tom.
-
AuthorPosts
-
May 14, 2016 at 5:04 am #194191Joel
Since updating to 4.5.2 and gp to the latest version the logo on the header is gone.
I tried to delete and re add on the customizer but it’s still not there.
Any suggestions? Here is the site http://www.barsons.comThanks
May 14, 2016 at 9:08 am #194237TomLead DeveloperLead DeveloperHi there,
Are you using any custom function (specifically generate_head_items())?
May 14, 2016 at 10:41 am #194265JoelYes from one of my previous posts here:
<?php
/*
Plugin Name: move widgets in header
Plugin URI:
Description: Used to move widgets in generatepress header
Version:
Author:
Author URI:
License:
License URI:
*/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;// Site title and tagline
if ( false == $disable_title || false == $disable_tagline ) : ?><?php if ( false == $disable_title ) : ?>
<p class=”main-title” itemprop=”headline”>” title=”<?php echo esc_attr( get_bloginfo( ‘name’, ‘display’ ) ); ?>” rel=”home”><?php bloginfo( ‘name’ ); ?></p>
<?php endif;if ( false == $disable_tagline ) : ?>
<p class=”site-description”><?php echo html_entity_decode( bloginfo( ‘description’ ) ); ?></p>
<?php endif; ?><?php endif;
// Site logo
if ( ! empty( $generate_settings[‘logo’] ) ) : ?><?php endif;
// Header widget
if ( is_active_sidebar(‘header’) ) : ?><?php dynamic_sidebar( ‘header’ ); ?><?php endif;
}
endif;May 14, 2016 at 10:50 am #194266TomLead DeveloperLead DeveloperInstead of that, use 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() { // Site title and tagline generate_construct_site_title(); // Site logo generate_construct_logo(); // Header widget generate_construct_header_widget(); } endif;
May 15, 2016 at 6:40 am #194361JoelThanks that worked.
May 15, 2016 at 9:26 am #194389FlorencioHi Tom,
Piggybacking on the OP’s post as I have the same issue of the logo gone after updating to WP 4.5.2.
I tried your suggestion and pasted it to the child functions.php but no luck. The site is still in my local drive only so I can’t link to it. I don’t have any custom functions pertaining to generate_head_items() other than the code you have above.
Any other recommendations I can try?
May 15, 2016 at 10:06 am #194399FlorencioI forgot to mention that the logo shows when I use the “parent” GeneratePress theme.
Thanks.
May 15, 2016 at 10:07 am #194400TomLead DeveloperLead DeveloperIf you go into “Customize > Site Identity”, is the logo set?
If the logo shows when you use the parent theme, something in your child theme is messing it up. What do you have in your functions.php file?
May 15, 2016 at 10:28 am #194408FlorencioHere’s the functions.php in the child theme:
<?php
add_action( ‘wp_enqueue_scripts’, ‘theme_enqueue_styles’ );
function theme_enqueue_styles() {
wp_enqueue_style( ‘parent-style’, get_template_directory_uri() . ‘/wp-content/themes/generatepress/style.css’ );
wp_enqueue_style( ‘child-style’,
get_stylesheet_directory_uri() . ‘/wp-content/themes/generatepress-child/style.css’,
array(‘parent-style’)
);
}//Remove Media Library Tab
function remove_medialibrary_tab($tabs) {
if ( !current_user_can( ‘administrator’ ) ) {
unset($tabs[‘library’]);
return $tabs;
}
else
{
return $tabs;
}
}
add_filter(‘media_upload_tabs’,’remove_medialibrary_tab’);//Add login-logout to nav
if( ! function_exists( ‘add_loginout_to_menu’ ) ) {
function add_loginout_to_menu( $items, $args ){
//Nav location in your theme. In this case, primary nav. Adjust accordingly.
if( is_admin() || $args->theme_location != ‘primary’ )
return $items;
if( is_user_logged_in( ) ) {
$link = ‘‘ . __( ‘Logout’ ) . ‘‘;
}
else $link = ‘‘ . __( ‘Login’ ) . ‘‘;
return $items.= ‘<li id=”loginout-link” class=”menu-item menu-type-link”>’. $link . ‘‘;
}
}
add_filter( ‘wp_nav_menu_items’, ‘add_loginout_to_menu’, 10, 2 );
?>
<?php/*
* Creating a function to create our CPT
*/function custom_post_type() {
// Set UI labels for Custom Post Type
$labels = array(
‘name’ => _x( ‘Campaigns’, ‘Post Type General Name’, ‘generate’ ),
‘singular_name’ => _x( ‘Campaign’, ‘Post Type Singular Name’, ‘generate’ ),
‘menu_name’ => __( ‘Campaigns’, ‘generate’ ),
‘parent_item_colon’ => __( ‘Parent Campaign’, ‘generate’ ),
‘all_items’ => __( ‘All Campaigns’, ‘generate’ ),
‘view_item’ => __( ‘View Campaign’, ‘generate’ ),
‘add_new_item’ => __( ‘Add New Campaign’, ‘generate’ ),
‘add_new’ => __( ‘Add New’, ‘generate’ ),
‘edit_item’ => __( ‘Edit Campaign’, ‘generate’ ),
‘update_item’ => __( ‘Update Campaign’, ‘generate’ ),
‘search_items’ => __( ‘Search Campaign’, ‘generate’ ),
‘not_found’ => __( ‘Not Found’, ‘generate’ ),
‘not_found_in_trash’ => __( ‘Not found in Trash’, ‘generate’ ),
);// Set other options for Custom Post Type
$args = array(
‘label’ => __( ‘campaigns’, ‘generate’ ),
‘description’ => __( ‘Campaigns’, ‘generate’ ),
‘labels’ => $labels,// Features this CPT supports in Post Editor
‘supports’ => array( ‘title’, ‘editor’, ‘excerpt’, ‘author’, ‘thumbnail’, ‘comments’, ‘revisions’, ‘custom-fields’, ),// You can associate this CPT with a taxonomy or custom taxonomy.
//’taxonomies’ => array( ‘genres’ ),
/* A hierarchical CPT is like Pages and can have
* Parent and child items. A non-hierarchical CPT
* is like Posts.
*/
‘hierarchical’ => false,
‘public’ => true,
‘show_ui’ => true,
‘show_in_menu’ => true,
‘show_in_nav_menus’ => true,
‘show_in_admin_bar’ => true,
‘menu_position’ => 5,
‘can_export’ => true,
‘has_archive’ => true,
‘exclude_from_search’ => false,
‘publicly_queryable’ => true,
‘capability_type’ => ‘page’,
);// Registering your Custom Post Type
register_post_type( ‘campaigns’, $args );}
/* Hook into the ‘init’ action so that the function
* Containing our post type registration is not
* unnecessarily executed.
*/add_action( ‘init’, ‘custom_post_type’, 0 );
?>
<?php /* — set featured image in ACF — */function acf_set_featured_image( $value, $post_id, $field ){
if($value != ”){
//Add the value which is the image ID to the _thumbnail_id meta data for the current post
add_post_meta($post_id, ‘_thumbnail_id’, $value);
}return $value;
}// acf/update_value/name={$field_name} – filter for a specific field based on it’s name
add_filter(‘acf/update_value/name=campaign_image’, ‘acf_set_featured_image’, 10, 3);// Adds classes for custom post types to body_class() and post_class() 4/4/16
function fb_add_body_class( $class ) {
$post_type = ‘campaigns’; // the Post Typeif ( get_query_var(‘post_type’) === $post_type ) { // only, if post type is active
$class[] = $post_type;
$class[] = ‘type-‘ . $post_type;
}return $class;
}
add_filter( ‘body_class’, ‘fb_add_body_class’ );
// End – adds classes../* 20160514 Fix header logo */
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()
{// Site logo
generate_construct_logo();
// Header widget
generate_construct_header_widget();// Site title and tagline
generate_construct_site_title();}
endif;
/* 20160514 End fix header logo */?>
May 15, 2016 at 11:24 am #194417TomLead DeveloperLead DeveloperGet rid of this:
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' ); function theme_enqueue_styles() { wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/wp-content/themes/generatepress/style.css' ); wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/wp-content/themes/generatepress-child/style.css', array(‘parent-style’) ); }
GP does that for you.
Do you have any template files added to your child theme? header.php specifically?
May 15, 2016 at 2:31 pm #194468FlorencioYup – I had a header.php that was the culprit. Deleted it and the logo’s back. Positioning’s wrong though but I think I can figure out a way to align them in the center again. (It’s weird; the logo’s aligned left while the title and tag line is center aligned.)
Thank you, Tom! As always you’re quick to respond and spot-on!
May 15, 2016 at 4:42 pm #194510TomLead DeveloperLead DeveloperGlad I could help 🙂
Does “Customize > Layout > Header alignment” not work for the alignment?
May 15, 2016 at 7:41 pm #194539FlorencioThat and fixing the CSS did the trick.
Thanks again, Tom!
May 15, 2016 at 9:55 pm #194552TomLead DeveloperLead DeveloperYou’re welcome 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.