Forums

[resolved] How to use ELSEIF in the sidebar (5 posts)

  1. razclud
    Member
    Posted 2 years ago #

    <?php
    
    if ( is_page('home')) { 
    
     echo '<li>';
    
    		<h3></h3>
    		<iframe>;
    
     echo '</li>';
    
    } elseif ( is_page('2')) {	
    
     echo '<li>';
    
        	<div class="cloud">
    
     echo '</li>';
    
    } else { 
    
     echo '<li>';
    
        	<h3></h3>
    		<iframe>;
    
     echo '</li>';
    
    <?php } ?>

    I am trying to make this thing work in my sidebar and i keep getting parse error and have no idea whats wrong. I want to make some html appear in my sidebar on my pages, to modify it so that each time i access the page a different sidebar be generated.

    Does anyone care to help a novice?

    Thank you very much

  2. Michael Fields
    Member
    Posted 2 years ago #

    try something like this:

    <?php if ( is_page('home')) : ?>
    	<li>
    		<h3></h3>
    		<iframe>
    	</li>
    <?php elseif ( is_page('2')) : ?>
    	<li>
        	<div class="cloud">
    	</li>
    <?php else : ?>
    	<li>
        	<h3></h3>
    		<iframe>
    	</li>
    <?php endif; ?>
  3. razclud
    Member
    Posted 2 years ago #

    Thanks for the reply,
    It doesn't display the right content on the home page's sidebar. Instead of displaying the content from is_page(home) it displays the ELSE. Elseif works like a charm.

  4. Michael Fields
    Member
    Posted 2 years ago #

  5. razclud
    Member
    Posted 2 years ago #

    Thank you VERY much
    Works great with is_home()

    wish you all the best!

Topic Closed

This topic has been closed to new replies.

About this Topic