Support » Fixing WordPress » How to loop all category posts except the open one in wordpress?

  • Resolved modeman

    (@modeman)


    in my single.php i want to show all category posts except the opened post.

    Here is my code: pastebin.com loop code

    Here is the code for category posts loop, it loops all category posts and the opened one, i do not want to loop opened post again

    <?php $catid = the_category_ID( false ); ?>
                            <?php $postCount = 1; $loop = new WP_Query( array( 'tax_query' => array(array(
                                    'taxonomy' => 'category',
                                    'field' => 'id',
                                    'terms' => $catid
                                )), 'post_type' => 'post', 'posts_per_page' => 15 ) ); if ($loop->have_posts()) { ?>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to loop all category posts except the open one in wordpress?’ is closed to new replies.