[resolved] childtheme custom logo (5 posts)

  1. Demetrius Pop
    Posted 3 years ago #

    The Site
    I have a childtheme of twenty twelve.
    I have php code in header.php for a custom logo; see below:

    			<?php if ($my_path_show_logo  == 'true') { ?>
    <h1 id="site-title"><span><a href="<?php echo get_option('home'); ?>"/><img class="site-logo" src="<?php echo get_stylesheet_directory_uri(); ?>/images/Logo.jpg" alt="site logo" /></a></span></h1><?php } ?>

    The image is not showing up or even being registered. I have also tried get bloginfo - stylesheet directory with the same file path-with the same results.

    please help :)

  2. Michael
    Forum Moderator
    Posted 3 years ago #

    where is this variable $my_path_show_logo set to 'true'?

    have you tried to check for boolean true:

    if( $my_path_show_logo == true ) {

  3. Demetrius Pop
    Posted 3 years ago #

    That variable is set in my childtheme options.php for an admin page option. It works when I use the same file path to set a background image (logo). (when the checkbox is ticked in the admin panel)

  4. Demetrius Pop
    Posted 3 years ago #

    The Site
    The code below registers the image, but it does not load it. ( it gives an error in the developer tool).
    So, at least now I'm getting it registered. I think maybe this is a path error or the fact that I'm trying to ignore twenty twelves' bloginfo instead of overriding it?

    function logo() {
    	if( get_bloginfo('stylesheet_directory')."/../my-twentytwelve/images/Logo.jpg") { ?>
    		<?php echo '<img src="' . get_bloginfo('stylesheet_directory') . "/../my-twentytwelve/images/Logo.jpg" . '/>';
    add_action('wp_head', 'logo');
  5. Demetrius Pop
    Posted 3 years ago #

    It seems that I needed to add an image to the header in the admin panel ( to use as the logo), which seems to be the way the options panel code is set up.

Topic Closed

This topic has been closed to new replies.

About this Topic