• I”m using this piece of code and it works fine except I don’t want it to show up on the home page. Everything I’ve tried issues a syntax error.

    I want it to be…if it’s NOT the home page then do this.

    <div id="headerleft">
    <?php if ( isset ($swp_options['swp_logo']) &&  ($swp_options['swp_logo']!="") ) {
    ?>
     <div class="logo"><img src="<?php echo esc_attr(strip_tags($swp_options['swp_logo'])); ?>" alt="<?php esc_attr(strip_tags(bloginfo('name'))); ?>"  /></div>
     <?php } else { ?>
         <h1><?php esc_attr(strip_tags(bloginfo('name'))); ?></h1> <h5><?php esc_attr(strip_tags(bloginfo('description'))); ?></h5>
         <?php } ?>
     </div>

    Can anyone show me where and how to put the (!is_home() in??

    Much appreciated!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Assuming you want all that code conditionalised, this should do it…

    <?php if( !is_home() ) : ?>
    <div id="headerleft">
    	<?php if( isset( $swp_options['swp_logo'] ) && ( !empty( $swp_options['swp_logo'] ) ) ) : ?>
    		<div class="logo"><img src="<?php echo esc_attr(strip_tags($swp_options['swp_logo'])); ?>" alt="<?php esc_attr(strip_tags(bloginfo('name'))); ?>"  /></div>
    	<?php else : ?>
    		<h1><?php esc_attr(strip_tags(bloginfo('name'))); ?></h1>
    		<h5><?php esc_attr(strip_tags(bloginfo('description'))); ?></h5>
    	<?php endif; ?>
    </div>
    <?php endif; ?>

    Hope that helps. ??

    Thread Starter Kburrows

    (@kburrows)

    Thats what I thought would work, but I’m still getting the logo on the home page.

    I have the home set as a static page. Not sure why it’s not working. The code is in the side bar, it should just be empty on the home page.

    Any other ideas? I appreciate your help.

    is_home refers to the blog’s home. For a static front page you’re looking for is_front_page()

    Thread Starter Kburrows

    (@kburrows)

    No joy – I deleted the 2nd endif it generated an error. The logo is still there regardless of the page.

    <?php if (!is_front_page() ); ?>
    <div id=”headerleft”>
    <?php if( isset( $swp_options[‘swp_logo’] ) && ( !empty( $swp_options[‘swp_logo’] ) ) ) : ?>
    <div class=”logo”><img src=”<?php echo esc_attr(strip_tags($swp_options[‘swp_logo’])); ?>” alt=”<?php esc_attr(strip_tags(bloginfo(‘name’))); ?>” /></div>
    <?php else : ?>
    <h1><?php esc_attr(strip_tags(bloginfo(‘name’))); ?></h1>
    <h5><?php esc_attr(strip_tags(bloginfo(‘description’))); ?></h5>
    <?php endif; ?>
    </div>

    Simple Typo. Put the last endif back in and swap out
    <?php if (!is_front_page() ); ?>
    with
    <?php if ( !is_front_page() ) : ?>

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘conditional NOT home condition tag’ is closed to new replies.