Well here is the code which displays the header part on the wordpress theme which I am currently using.
<div id="site-branding" class="clearfix">
<?php
$logo = isset($options['logo'])? $options['logo']: '';
if ($logo == ""){
$hidetitle = $options['hide_title'];
if ($hidetitle == "No") {
if(!is_home() || !is_front_page()) { ?>
<div class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>"><?php bloginfo('name'); ?></a></div>
<div class="site-description"><?php bloginfo('description'); ?></div>
<?php } else { ?>
<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>"><?php bloginfo('name'); ?></a></h1>
<div class="site-description"><?php bloginfo('description'); ?></div>
<?php } }
} else {
echo '<div class="site-logo"><a href="'. esc_url( home_url( '/' ) ) .'">';
echo '<img title="'. get_bloginfo('name') .'" src="' . $logo .'" />';
echo '</a></div>';
} ?>
</div><!-- end #site-branding -->
The first part of this code checks the presence of logo. If the logo is not present, it will display only the name and description of theme provided it is not checked hidden in theme options. It will style the name and description slightly different on home/front page while on other page a different style.However, if logo is present it will display the logo on all pages.
Now what I want to achieve is to style (with CSS) the LOGO differently on Front/Home page while on other pages I want to add some extra css classes to logo.
I tried to use elseif statement in the second part of above code but couldn't get the desired result.
Please suggest me how to do it properly.
UPDATE: Because I can't post the answer to my own question, I am posting here. Well, I used this code after removing some PHP closing elements and it worked like charm. I am posting it here again just to make it sure that there is no error.
if(is_home() || is_front_page()) {
echo '<h1 class="site-logo"><a href="'. esc_url( home_url( '/' ) ) .'">';
echo '<img calss="mylogo1" title="'. get_bloginfo('name') .'" src="' . $logo .'" />';
echo '</a></h1>';
} else {
echo '<div class="site-logo"><a href="'. esc_url( home_url( '/' ) ) .'">';
echo '<img calss="mylogo2" title="'. get_bloginfo('name') .'" src="' . $logo .'" />';
echo '</a></div>';
} ?>
Us the same you used before , set different class (i.e mylogo1/mylogo2) for each of your condition.