Support » Fixing WordPress » WP_query not working on homepage

  • Can anyone tell me why the latest news and events aren’t showing on the homepage, but DO show anywhere else…

    I’m using two instances of the following code:

    <?php $my_query2 = new WP_Query('category_name=cat-name-here&showposts=1&orderby=asc');
      while ($my_query2->have_posts()) : $my_query2->the_post();
      $do_not_duplicate = $post->ID; ?>
        <h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
    <?php echo substr(get_the_excerpt(), 0, 100); ?>...
    <hr />
    <p><a href="<?php echo get_category_link(1);?>">View All <?php echo get_cat_name(1); ?> &raquo;</a></p>
      <?php endwhile; ?>
  • The topic ‘WP_query not working on homepage’ is closed to new replies.