query_posts()
is a horrible function and shouldn’t be used. Also it doesn’t has much to do with loading template, since it was originally designed to be used in template. Should not be used.
If you are looking for logic of how WP picks template files from theme to load see Template Hierarchy.
If you just want to load some [part of] template manually, get_template_part()
is probably what you are looking for.
Related Posts:
- How to show related posts by category
- How to display posts by current user/author in a custom page template?
- How to get previous 10 days post from a specific date – WP Query
- Query only Posts from Both of Two Category?
- WordPress get posts by date without query_posts
- Can I set and show “important” post in my blog?
- Inserting custom data to the_post() during loop
- Why is querying posts messing up my pages?
- How to get posts from a current post’s month?
- While loop articles – if statement order
- Post Filtering by GET URL parameters
- How to give classname to post if post has no content?
- Get posts from current category?
- How to merge the content of posts that have the same title?
- get posts, run a custom query, and join the results
- WP_Query to get posts in a specific tag or has post_format
- How to get all post titles starting with numbers and symbols?
- Word count for all posts of all authors
- How to show related posts by detecting the current category?
- Get Posts Under Custom Taxonomy
- Keep featured content post in homepage with original order
- How to get posts published between a date and today?
- How to get post content by calling ajax?
- Get the ID of the latest post
- the_author() returns empty string
- get_children() Not Working with orderby Parameter
- How to get all posts related to particular category name?
- get all posts ID from a category
- Display all posts from specific categories on a page
- get comments and get posts in loop
- How to exclude latest x posts from a paginated query?
- How to know if get_posts() failed?
- Display content from a specific category
- post_name empty after wp_insert_post
- Query posts distinct authors
- Number of posts per page setting is not working?
- Show the title of the latest post by author
- WordPress Posts Out Of Order after 3.1 Update
- Setting pagination for images attached to a post
- Insert custom div between posts
- Can’t show comments count per post outside loop
- is there a better way of combining this?
- Only display posts with comments
- Order post by year DESC and month ASC
- How to Display Post View Count
- Different amount of posts on homepage than paged pages
- Featured Posts for Category Pages
- Quickest way to get last or oldest post date – WP Query
- Cannot Update A Post, 404 Error
- Function to show random posts from a category
- Hiding posts in a list from specified categories
- Posts are not showing up on particular category
- get selected post using $_GET
- How Can i Get 5 Recent Post Title With Corresponding Link?
- How would I get 1 latest post from a query for 5 posts?
- Filter Posts By Tag
- setup_postdata doesn`t seem ot be working
- Exclude posts with empty post_content in wp_query
- Encrypt / Decrypt Post Title and Details
- Get Posts via Taxonomy Term Name with Space
- Get specific posts by ID in wordpress
- Improving WP_Query for performance when random posts are ordered
- Create dropdown list post
- I would like to give special promotion for the first 100 posts in my blog? Can anyone tell me how to do that?
- Automatically republish old posts
- previewing my posts on static page?
- Exclude newest post from category X but show rest
- get_next_post() and get_previous_post() return wrong posts
- Reset Popular post query?
- Get posts by name and taxonomy term
- How To Get Posts With A Specific Word
- How do I restart my loop with get_next_post()?
- Get mixed category random posts
- WordPress not opening posts with only numbers if permalink is post_name
- Limit popular posts by days
- Why WP_Query(‘showposts=5’) shows only 1 post?
- is there a way to show the the post title after the image?
- Display posts with tag that matches current post title
- get_the_content(“more…”) returns full text
- Display all posts that were published before full post on single.php
- Category Foreach keeps looping?
- Blog post per page setting conflicting with custom WP_Query?
- How to exclude latest x posts from a paginated query?
- Two loops, one AJAX loop, exclude posts in first loop from second loop, loops are in different files
- Insert Content In Between Post Feed
- Post Loop Missing Most Recent Post
- Get Posts Under Custom Taxonomy
- Include sticky posts on the static page front page
- Get attachments for posts that belongs to a specific category
- Random ajax load only works with posts_per_page set to -1
- Pagination with an array of post objects?
- Display an author’s posts on his own author page
- Any way for get_next_post() to use the actual post order instead of publish order?
- Multi row post list
- posts_per_page option limits the number of Gallery items
- How to make multiple sections in home pulling posts category wise?
- wp_posts table: safely remove unused columns to save database storage
- Query Posts by Custom Field
- Order posts alphabetically: how to set order=asc in mysql query?
- How to order posts in an arbitrary order?