• my header logo code looks like this,

    <div class="logo">
    
              <?php if(of_get_option('logo_type') == 'text_logo'){?>
    
              	<?php if( is_front_page() || is_home() || is_404() ) { ?>
                  <h1><a href="<?php bloginfo('url'); ?>/" title="<?php bloginfo('description'); ?>"><?php bloginfo('name'); ?></a></h1>
                <?php } else { ?>
                  <h2><a href="<?php bloginfo('url'); ?>/" title="<?php bloginfo('description'); ?>"><?php bloginfo('name'); ?></a></h2>
                <?php } ?>
    
              <?php } else { ?>
    
              	<?php if(of_get_option('logo_url') != ''){ ?>
                	<a href="<?php bloginfo('url'); ?>/" id="logo"><img src="<?php echo of_get_option('logo_url', "" ); ?>" alt="<?php bloginfo('name'); ?>" title="<?php bloginfo('description'); ?>"></a>
                <?php } else { ?>
                	<a href="<?php bloginfo('url'); ?>/" id="logo"><img src="<?php bloginfo('template_url'); ?>/images/logo.png" alt="<?php bloginfo('name'); ?>" title="<?php bloginfo('description'); ?>"></a>
                <?php } ?>
    
              <?php }?>
              <p class="description"><?php bloginfo('description'); ?></p>
            </div>

    i need to change the logo of a particular page with other logo. tried the code

    <?php $page_id=get_the_ID();
    if(is_page()) { $image='head-image-'.$page_id.'.png'; };
    if(!file_exists(TEMPLATEPATH.'/images/'.$image)) { $image='logo.png'; }
    echo '<img src="'.get_bloginfo('template_url').'/images/'.$image.'"/>'; ?>

    but the logo is not shown on categories and posts

    Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • try to change this section:

    <?php } else { ?>
    
              	<?php if(of_get_option('logo_url') != ''){ ?>
                	<a href="<?php bloginfo('url'); ?>/" id="logo"><img src="<?php echo of_get_option('logo_url', "" ); ?>" alt="<?php bloginfo('name'); ?>" title="<?php bloginfo('description'); ?>"></a>
                <?php } else { ?>
                	<a href="<?php bloginfo('url'); ?>/" id="logo"><img src="<?php bloginfo('template_url'); ?>/images/logo.png" alt="<?php bloginfo('name'); ?>" title="<?php bloginfo('description'); ?>"></a>
                <?php } ?>
    
              <?php }?>

    to:

    <?php } else { ?>
    
              	<?php if( is_page('particular') ) { ?>
                	<a href="<?php bloginfo('url'); ?>/" id="logo"><img src="<?php bloginfo('template_url'); ?>/images/particularlogo.png" alt="<?php bloginfo('name'); ?>" title="<?php bloginfo('description'); ?>"></a>
    
                <?php } elseif(of_get_option('logo_url') != ''){ ?>
                	<a href="<?php bloginfo('url'); ?>/" id="logo"><img src="<?php echo of_get_option('logo_url', "" ); ?>" alt="<?php bloginfo('name'); ?>" title="<?php bloginfo('description'); ?>"></a>
                <?php } else { ?>
                	<a href="<?php bloginfo('url'); ?>/" id="logo"><img src="<?php bloginfo('template_url'); ?>/images/logo.png" alt="<?php bloginfo('name'); ?>" title="<?php bloginfo('description'); ?>"></a>
                <?php } ?>
    
              <?php }?>

    the particularlogo.png would need to be in the /images/ folder of your theme.

    https://codex.www.ads-software.com/Function_Reference/is_page

    Thread Starter powerplay_vj

    (@powerplay_vj)

    Thanks a million, it works like charm !!

    what to do if three pages are there with three different logos and the default logo should be there for categories and pages.

    what to do if three pages are there with three different logos

    expand this section;

    <?php if( is_page('particular') ) { ?>
                	<a href="<?php bloginfo('url'); ?>/" id="logo"><img src="<?php bloginfo('template_url'); ?>/images/particularlogo.png" alt="<?php bloginfo('name'); ?>" title="<?php bloginfo('description'); ?>"></a>

    for example:

    <?php if( is_page('particular') ) { ?>
                	<a href="<?php bloginfo('url'); ?>/" id="logo"><img src="<?php bloginfo('template_url'); ?>/images/particularlogo.png" alt="<?php bloginfo('name'); ?>" title="<?php bloginfo('description'); ?>"></a>
    
    <?php } elseif( is_page('otherpage') ) { ?>
                	<a href="<?php bloginfo('url'); ?>/" id="logo"><img src="<?php bloginfo('template_url'); ?>/images/otherpagelogo.png" alt="<?php bloginfo('name'); ?>" title="<?php bloginfo('description'); ?>"></a>
    
    <?php } elseif( is_page('thirdpage') ) { ?>
                	<a href="<?php bloginfo('url'); ?>/" id="logo"><img src="<?php bloginfo('template_url'); ?>/images/thirdpagelogo.png" alt="<?php bloginfo('name'); ?>" title="<?php bloginfo('description'); ?>"></a>
    Thread Starter powerplay_vj

    (@powerplay_vj)

    Thanks again. You are a life saver ?? Hats off !!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Different header for a particular page only’ is closed to new replies.