[Resolved] Logo missing since update

Home Forums Support [Resolved] Logo missing since update

Home Forums Support Logo missing since update

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #194191
    Joel

    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.com

    Thanks

    #194237
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Are you using any custom function (specifically generate_head_items())?

    #194265
    Joel

    Yes 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;

    #194266
    Tom
    Lead Developer
    Lead Developer

    Instead 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;
    #194361
    Joel

    Thanks that worked.

    #194389
    Florencio

    Hi 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?

    #194399
    Florencio

    I forgot to mention that the logo shows when I use the “parent” GeneratePress theme.

    Thanks.

    #194400
    Tom
    Lead Developer
    Lead Developer

    If 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?

    #194408
    Florencio

    Here’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 Type

    if ( 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 */

    ?>

    #194417
    Tom
    Lead Developer
    Lead Developer

    Get 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?

    #194468
    Florencio

    Yup – 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!

    #194510
    Tom
    Lead Developer
    Lead Developer

    Glad I could help 🙂

    Does “Customize > Layout > Header alignment” not work for the alignment?

    #194539
    Florencio

    That and fixing the CSS did the trick.

    Thanks again, Tom!

    #194552
    Tom
    Lead Developer
    Lead Developer
Viewing 14 posts - 1 through 14 (of 14 total)
  • You must be logged in to reply to this topic.