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
- Keep featured content post in homepage with original order
- Get the ID of the latest post
- Display all posts from specific categories on a page
- How to exclude latest x posts from a paginated query?
- Display content from a specific category
- 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
- Order post by year DESC and month ASC
- How to Display Post View Count
- 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
- setup_postdata doesn`t seem ot be working
- 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?
- get_next_post() and get_previous_post() return wrong posts
- Get posts by name and taxonomy term
- Get mixed category random posts
- WordPress not opening posts with only numbers if permalink is post_name
- Limit popular posts by days
- is there a way to show the the post title after the image?
- get_the_content(“more…”) returns full text
- Display all posts that were published before full post on single.php
- Two loops, one AJAX loop, exclude posts in first loop from second loop, loops are in different files
- Post Loop Missing Most Recent Post
- Random ajax load only works with posts_per_page set to -1
- Display an author’s posts on his own author page
- Order posts alphabetically: how to set order=asc in mysql query?
- How to order posts in an arbitrary order?
- Wrong post title displayed from loop
- WordPress query_posts by tag doesn’t work anymore(?)
- do more action after I publish a post
- Retrieve only posts from a specific user in wp-admin/edit.php
- Count number of posts of current month
- WordPress website loads more posts than expected
- query post limits
- How to get posts published on the latest date?
- Why posts array is empty?
- How to create a “latest news” page showing a list of posts from blog category
- How to check in functions.php if there is data in a WP_Query?
- Get post by tag
- Random posts that always include a particular post?
- Related Posts function not working
- All categories displays the same posts
- Query function not executed between element [closed]
- Echo the number of posts being displayed
- Exclude a category of posts in author template
- Display specific posts on home page
- If post does not exist, do something
- Internal linking to posts permalink fail because of spaces and stripe at postname
- Change content off every sixth element
- Move position in post list for a custom checkbox column
- How to create loop of posts except post ID defined via ACF field
- How to mark only one post as Featured post?
- How to display particular categorie’s post which associated to specific user?
- wp_query args with relation
- Use special template for the first post in the loop
- How to convert return type of ‘get_posts()’ same as ‘wp_get_recent_posts()’?
- How to get all posts in gallery post format template
- Repeating post how to solve this
- How to get the current user post and it’s ID?
- show latest authors blog post
- How to get only current images of a post
- Why I obtain this WP_Query strange behavior trying to select posts having a specific tag?
- Retrieve latest post by multiple categories with ID
- External link not showing on post but showing on comment
- How to inject a post within a loop
- wp_query select if have comments
- Creating pages and getting their values from the database table
- get_posts includes “auto drafts”?
- wordpress show category link instead of post link [closed]
- posts_per_page – Repeats only first posts ‘post__in’ array
- NewsPaper WP Theme – Additional Related Posts Filter by Time (divTag composer)
- Do I need to create a multisite for querying posts from multiple WordPress sites?
- View post with specific category id and name which I selected in the backend (drop-down option)
- Dynamic archive of posts by date