WordPress.org

Ready to get started?Download WordPress

Forums

Conditional statement help (6 posts)

  1. AMEEKER
    Member
    Posted 2 years ago #

    I'm still learning conditional statements, but I need to use one for a piece of a client's site. The site I inherited uses this piece of code below to display a slider on every page. I need to NOT display that slider on ONE page only, and instead display one particular graphic.

    Can someone help me piece that together? It would be within the div feature, taking the place of featurearea (you can see the site at owenlawyers dot com if you need to look. I'll need to display one graphic at the drunk driving page to replace all of the random stuff between the header/nav and content areas)

    <?php }
    function slide_header() { ?>
    	<div class="contentSlide">
    		<div id="feature">
    			<div id="featurearea" class=" fix">
    				<div class="slideshow">
    					<img src="http://owenlawyers.com/wp-content/themes/thesis_182/custom/images/featureslide1.jpg" />
    					<img src="http://owenlawyers.com/wp-content/themes/thesis_182/custom/images/featureslide2.jpg" />
    					<img src="http://owenlawyers.com/wp-content/themes/thesis_182/custom/images/featureslide3.jpg" />
    					<img src="http://owenlawyers.com/wp-content/themes/thesis_182/custom/images/featureslide4.jpg" />
    					<img src="http://owenlawyers.com/wp-content/themes/thesis_182/custom/images/featureslide5.jpg" />
    					<img src="http://owenlawyers.com/wp-content/themes/thesis_182/custom/images/featureslide6.jpg" />
    					<img src="http://owenlawyers.com/wp-content/themes/thesis_182/custom/images/featureslide7.jpg" />
    				</div>
    			</div>
    			<div id="feature-footer" class="fix thumb_nav">
    				<div id="featurenav">
    					Criminal Defense Lawyers Located in Columbus, Ohio
    				</div>
    			</div>
    			<div class="clear"></div>
    		</div>
    	</div>
  2. Eric Mann
    Member
    Posted 2 years ago #

    Just wrap things with is_page(). You can pass in the page ID or the page slug.

    So ...

    <div id="feature">
      <?php if ( is_page( 'drunk-driving' ) ) { ?>
        <div id="drunk-driving">
          ...
        </div>
      <?php } else { ?>
        <div id="featurearea">
          ...
        </div>
      <?php } ?>
      <div id="feature-footer">
        ...
      </div>
      <div class="clear"></div>
    </div>
  3. johnbhartley
    Member
    Posted 2 years ago #

    What he said... the main thing is the

    <?php if ( is_page( 'drunk-driving' )) { ?>
    
    <?php } else { ?>
    
    <?php } ?>
  4. AMEEKER
    Member
    Posted 2 years ago #

    How does this look?

    <div id="feature">
      <?php if ( is_page( 'drunk-driving' ) ) { ?>
        <div id="drunk-driving">
          <a href="http://www.columbusduiattorneys.com/register-for-your-free-dui-defense-guide/"><img src="http://owenlawyers.com/images/sample-image.png"></a>
        </div>
      <?php } else { ?>
        <div id="featurearea">
          <div id="featurearea" class=" fix">
    				<div class="slideshow">
    					<img src="http://owenlawyers.com/wp-content/themes/thesis_182/custom/images/featureslide1.jpg" />
    					<img src="http://owenlawyers.com/wp-content/themes/thesis_182/custom/images/featureslide2.jpg" />
    					<img src="http://owenlawyers.com/wp-content/themes/thesis_182/custom/images/featureslide3.jpg" />
    					<img src="http://owenlawyers.com/wp-content/themes/thesis_182/custom/images/featureslide4.jpg" />
    					<img src="http://owenlawyers.com/wp-content/themes/thesis_182/custom/images/featureslide5.jpg" />
    					<img src="http://owenlawyers.com/wp-content/themes/thesis_182/custom/images/featureslide6.jpg" />
    					<img src="http://owenlawyers.com/wp-content/themes/thesis_182/custom/images/featureslide7.jpg" />
    				</div>
    		</div>
        </div>
      <?php } ?>
      <div id="feature-footer" class="fix thumb_nav">
    				<div id="featurenav">
    					Criminal Defense Lawyers Located in Columbus, Ohio
    				</div>
    	</div>
    			<div class="clear"></div>
    </div>
  5. Eric Mann
    Member
    Posted 2 years ago #

    That'll do it :-)

  6. AMEEKER
    Member
    Posted 2 years ago #

    Thanks, Eric.

    Again.

    ;-)

Topic Closed

This topic has been closed to new replies.

About this Topic