Support » Fixing WordPress » Loading sidebar content based on is_page

  • I am trying to make a dynamic sidebar that loads based on the is_page function. Here is the code i placed:

    <?php wp_list_categories(‘show_count=1&title_li=<h2>Categories</h2>’); ?>

    <?php if (is_page(‘eadmin’) ) { ?>
    <?php query_posts(‘category_ID=13&showposts=10’); ?>
    <?php while (have_posts()) : the_post(); ?>
    <h4><?php the_title(); ?></h4>
    <?php endwhile;
    } elseif (is_page(‘eproject’) ) { ?>
    <?php query_posts(‘category_ID=3&showposts=10’); ?>
    <?php while (have_posts()) : the_post(); ?>
    <h4><?php the_title(); ?></h4>
    <?php endwhile;
    } else { ?>
    //whatever goes in here
    <?php } ?>

    The result is when i am on the eadmin or eproject page i get the else result above(?) i checked the page names in wp-admin and have tried both category_ID and category_name with no different result. What am I missing here?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Loading sidebar content based on is_page’ is closed to new replies.