WordPress.org

Ready to get started?Download WordPress

Forums

How do i Re-Insert the loop through query? (4 posts)

  1. ReginaldTerrell
    Member
    Posted 1 year ago #

    I am using this code to call post from a certain taxonomy term in the loop. But it excluded all the other post in the loop and it only shows the post from the taxonomy terms.

    What do i add to the code for it show the regular post and the post from the taxonomy terms.

    <?php // Create empty array to store post ids in
             $excludes = array();
    
                             $args=array(
                             'post_type' => array ('gallery','videos'),
    			 'taxonomy'=>'series',
    			 'term' => 'pretty-little-liars',
                             'post_status' => 'publish',
                            );
                            query_posts( $args );
    
     if (have_posts()) : while(have_posts()) : the_post(); ?>
  2. bcworkz
    Member
    Posted 1 year ago #

    Call wp_reset_query() after the loop.

  3. ReginaldTerrell
    Member
    Posted 1 year ago #

    @bcworkx that didn't work

  4. bcworkz
    Member
    Posted 1 year ago #

    Sorry, I see now I misunderstood what you were asking. However, you still need to use wp_reset_query() afterwards anytime you use query_posts().

    I got enough from your question to know I misunderstood, but I'm not sure I understand completely. Best I can tell, you want to display that particular taxonomy posts first, then all normal posts after that?

    You would need two loops for that, the one you have, then the usual loop for regular posts, with wp_reset_query() in between.

Topic Closed

This topic has been closed to new replies.

About this Topic