Display Latest Post from all Categories

I am trying to loop all the latest post from all the categories but it is displaying only a post from single category. Below is the code that I am using.

<?php while (have_posts()) : the_post(); ?>
<li <?php post_class() ?> id="post-<?php the_ID(); ?>">
    <a class="wpn_title" href="https://wordpress.stackexchange.com/questions/57732/<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
    <div class="wpn_info">
        <?php echo get_avatar( get_the_author_email(), '40' ); ?>
        by <?php the_author_posts_link() ?><br />
        Posted <?php the_time('F jS, Y \a\t g:i a') ?>
    </div>
    <div class="wpn_post">
        <?php wpn_content_limit(get_the_content(),500); ?>
    </div>
    <div class="wpn_bottom">
        <a class="wpn_comments" href="<?php the_permalink() ?>#comments"><strong><?php comments_number(__('0'), __('1'), __('%')); ?></strong> Comments</a>
        <a class="wpn_continue" href="<?php the_permalink() ?>">Continue Reading</a>
    </div>
</li>
<?php endwhile; ?>

PS:

It looks like the issue is caused by the following code which I have placed on top of index.php. Is there something I missed?

<ul class="list">
                    <?php query_posts('r_sortby=highest_rated&r_orderby=DESC&showposts=4&cat=9') ?>
                        <?php while (have_posts()) : the_post(); ?>
                            <li>
                                <span class="num"><?php $key="ratings_users"; echo get_post_meta($post->ID, $key, true); ?></span>
                                <a class="img" href="https://wordpress.stackexchange.com/questions/57732/<?php echo get_permalink(); ?>"><?php if ( has_post_thumbnail() ) { the_post_thumbnail( 'top-score-thumb' ); } ?></a>
                                <div class="text"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_titlesmall('', '...', true, '20') ?></a></div>
                            </li>
                    <?php endwhile; ?>
            </ul>

1 Answer
1

sorry guys, I was suppose to end query_posts with <?php wp_reset_query(); ?> . This solved the issue.

Thanks

Leave a Comment