Support » Themes and Templates » Conditional tag isn't working

  • Resolved Anna

    (@ohthenoes)


    Latest version of WordPress on sidebar.php of a custom theme with no widgets enabled.

    Everything on the sidebar works everywhere on the site except for the bit meant for the homepage. It doesn’t show at all.

    Any ideas would be great 🙂

    <div id="sidebar">
    
    <h4>Subscribe</h4>
    <ul>
    <li><a href="http://domain.com">RSS Feed</a></li>
    </ul>
    
    <?php if (is_home() || is_front_page()) { ?>
    <h4>Home</h4>
    <ul>
    <li><a href="http://domain.com">My Link</a></li>
    </ul>
    <?php } ?>
    
    <?php if (is_page(array('6'))) { ?>
    <h4>Navigation</h4>
    <ul>
    <li <?php if (is_home()){echo 'class="current_page_item"';}?>><a href="<?php bloginfo('url'); ?>/">Home</a></li>
    <?php wp_list_pages('title_li=&depth=1&exclude=143,2,87,148,149'); ?>
    </ul>
    <?php } ?>
    
    <?php
      if($post->post_parent) {
      $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");
      $titlenamer = get_the_title($post->post_parent);
      }
      else {
      $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
      $titlenamer = get_the_title($post->ID);
      }
      if ($children) { ?>
      <h4><? echo $titlenamer ?></h4>
      <ul>
      <?php echo $children; ?>
      </ul>
    <?php } ?>
    
    <h4>Latest Updates</h4>
    <ul>
    <?php query_posts(array('tag__not_in' => array(5), 'showposts' => 3)); if ( have_posts() ) : while (have_posts()) : the_post(); ?>
    <li><a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
    <?php endwhile; endif; ?>
    </ul>
    
    <h4>Connect</h4>
    <ul>
    <?php wp_list_bookmarks('title_li=&category=2&categorize=0'); ?>
    </ul>
    
    <div id="paypalside">
    <p>paypal form here</p>
    </div>
    
    </div>
Viewing 2 replies - 1 through 2 (of 2 total)
  • Michael

    (@alchymyth)

    Forum Moderator

    if you have any custom queries in the main part of the site, try and add <?php wp_reset_query(); ?> at the begining of the sidebar.

    Hello sir.

    Thanks very much! The reset query worked great. Wish I thought of it earlier.

    Problem solved!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Conditional tag isn't working’ is closed to new replies.