• Hi,

    I’m am trying to add a loop after the content on several pages.

    I have managed to do this by adding this code to the bottom of my Page.php…

    <div class="row-fluid" id="blog">
    
    <?php
      if ( is_page( 'ski' ) ) {
        query_posts('cat=10');
    }
     elseif ( is_page( 'gear' ) ) {
          query_posts('cat=6');
    }
    elseif ( is_page( 'published' ) ) {
          query_posts('cat=7');
    }
    elseif ( is_page( 'behind-the-scenes' ) ) {
          query_posts('cat=9');
    }
    else{
    }
    ?>
    <script type="text/javascript">$('#blog').hide()</script>
    <?php
    }
    ?>
    
     <section class="<?php echo $myThemes_layout -> contentClass(); ?> list-view">
    <?php
    	if ( have_posts() ) {
    	 while ( have_posts() ) {
    	 the_post();
    	get_template_part( 'cfg/templates/view/list-view' );
    	}
    	}
    		else{
                            }
    
     		get_template_part( 'cfg/templates/pagination' );
                        ?>
                    </section>
    
    </div>

    Nowww I need to figure out how to remove the blog if the page is not one of the specified… AKA falls into the “else{}” category.

    I tired to do this by adding this…

    else{
    $('#blog').hide()
    }

    but it doesn’t seem to work. Any ideas??

Viewing 1 replies (of 1 total)
  • Try changing this:

    <?php
      if ( is_page( 'ski' ) ) {

    to this:

    <?php
      $showit = true;
      if ( is_page( 'ski' ) ) {

    this:

    else{
    }
    ?>

    to this:

    else{
       $showit = false;
    }
    if ($showit) :
    ?>

    and the last line from this:

    </div>

    to this:

    </div>
    <?php endif; ?>
Viewing 1 replies (of 1 total)
  • The topic ‘Can't remove div with Else statement’ is closed to new replies.