Don’t use query_posts
. As noted in the Codex:
Not for Secondary Loops You should not use query_posts() to create
secondary listings (for example, a list of related posts at the bottom
of the page, or a list of links in a sidebar widget).
You should use WP_Query
instead. E.g.
$args = array(
'post_type' => 'topic',
'posts_per_page' => '3',
'post_parent' => get_the_ID(),
'gdsr_sort' => 'thumbs',
'gdsr_ftvmin' => '1',
'gdsr_order' => 'desc',
'order' => 'DESC'
);
$query = new WP_Query($args);
if($query->have_posts()) :
while ( $query->have_posts() ) : $query->the_post();
// do your stuff
endwhile;
endif;
Related Posts:
- Get page ID of page that is set as the posts page
- Are post ID’s reliable?
- Get current post id in functions.php
- get all posts ID from a category
- Get the current post ID as a variable in Javascript
- Is post ID number always incremental n+
- Are all ID’s used unique?
- $post->ID displays wrong ID
- At my posts archive page, outside the loop, get_the_id() returns the top most post’s ID
- Showing random content / pictures from earlier posts in a sticky post?
- Get the post_id of a new post
- get post id in while loops outputting page id
- How can I display a specific user’s first published post?
- Undefined variable post_id in custom quick edit coloumn
- Getting post id from wp_insert_post_data function?
- Does an article (post) id ever change?
- How to get the post’s parent ID?
- Can a page_id and a post_id be same?
- Is there a better, more efficient way to get the post id outside the loop?
- Getting current post ID in functions.php
- Buddypress activity id
- How blog page in WordPress works : blog page retrieve first post ID
- Post-ID in url differs from $post->ID
- Why is my Blog Page ID == First Post ID?
- current post with current author
- Is it possible to change post id for an already added menu item in WordPress?
- Adding custom fields to bbpress reply form
- Get ALL post ID’s export list (Only id’s. Php or sql not important )
- How to get next post ID?
- Search results posts_orderby and ID
- Retrieve post ID from “querying” URL
- How to get a post’s content? [closed]
- obtain the author id given the post id
- How to get ID of the page included with get_page()?
- How to I retrieve the ID from the Posts page?
- Crazy Question – Updating Post ID
- Why I can not I use the variable outside my function?
- retrieve the oldest post id
- WP_Query custom field pass the post id
- Accessing Post ID Within Loop
- How do post IDs work in WordPress?
- Are post, page and category IDs unique to each other?
- The loop starting at a certain ID
- linking to post outside the loop
- Widget to show posts in the sidebar basing on its IDs
- Get a post’s ID
- Making posts permalinks consistent numbers
- How to get post id of last approved comment?
- Error while excluding a post from another loop (using its ID)
- Get post slug and match with menu item slug to change css
- WordPress Post ids big increment
- Reuse old post ID for new post after deleting post
- Get post attachment with post id
- How can i take all ids from untrash_post action?
- How do I apply a wordpress function to something with no ID inside an archive page?
- Get from the dashboard the ID of the current post being edited
- Only get post_id [duplicate]
- Surrogate ID for posts, is there an alternative field in the posts table?
- Is it possible to have dynamic post id # in add_menu_page()?
- Using Post ID and Page ID in same function
- unused post IDs
- Custom post page has attributes of latest post [closed]
- Can I get custom post items in select box (dropdown)
- What is $post->ID
- View post with specific category id and name which I selected in the backend (drop-down option)
- How can I locate the single buddypress forum post template? [closed]
- How to get post ID after removing that post?
- Difference between an archive and a page listing posts
- the_post_navigation seems to ignore same category filter
- How to avoid duplicate posts on front page?
- Remove some articles from the list in WPAdmin for a user
- Pagination – Posting First Page Content
- How to show featured image in custom post type dashboard post page
- Notification to Admin or Author upon new post [duplicate]
- Featured Image uploaded, attached and set but only appearing in the media library
- Hightlight unread posts or new posts since last login
- Editing 375 posts simultaneously? Maybe from the database?
- Why does WP_Post not contain its permalink?
- How Do I Get My Post Tags to Alphabetize?
- Remove Featured Image & All Media Uploaded to the Post
- Transition from Draft to Scheduled Post with wp_update_post
- Posts showing […] in it
- Custom Permalink Structure for Pages & Posts
- Getting a “404 Not Found” error when “Preview Changes” is clicked
- wp_update_post creating revisions instead of updating the post
- Audio post format with Advanced Custom Fields
- Same post appears in related Posts?
- How can I create an RSS feed that includes “Private” posts?
- Change post date in menu to post title
- Allowing Users to Register Themselves and Post : Does WordPerss Handle these Problems?
- DEL media from the post but keep my featured image or post
- wp_trash_post() duplicates post to trash
- Add view to admin menu to filter for specific criteria ( If post is child of specific Parent )
- Can I Paginate Post after every 25 tag?
- How to show posts ordered by random [duplicate]
- Trim excerpt to first paragraph
- WordPress loop uses unmodified posts array, why?
- Create new post on user registration
- WordPress Page Column Problem [closed]
- If meta_key exists then don’t select this post?