have_posts()
iterates over all posts found and actually returned in the query which depend in the posts_per_page
parameter.
And for your second question, using query_posts()
does overwrite the query and its not really the recommend method to alter or modify the query result, here is a nice question that explains better ways : When should you use WP_Query vs query_posts() vs get_posts()?
Related Posts:
- how to display full post with pagination on home page
- How do I change the gallery that is inserted in the post?
- Convert a complex webpage into WP theme
- Why orderby=”date” does not support manually changed posts?
- page.php showing loop of posts and not page content
- How to show single post page as home page
- Exclude category from
- Blog page not working
- Highlight static blog page link in header
- Block editors annoying warnings
- how to handle the loop using filling bootstrap grid structure?
- Cant’ Grab WordPress Built-in Posts Through Loop
- How do I allow certain users to make a certain type of post?
- I can’t find the relevant part of the loop in my theme file. How do I find the full content with “More…”
- Moved a website and excerpts don’t work for old posts
- Display post order ranking within wordpress loop
- Can the_post_navigation() be outside of the loop?
- Post are not showing up
- How to show the posts list into a static page? Problems to use the loop into a static page
- The post order is different for logged-in and non-logged-in users? [closed]
- How to show only the date, the title and a little “summary” of my WordPress post in my custom theme?
- Get posts after calculating meta key
- Is there a block to print post link standalone in a block theme?
- WordPress Ajax load doesn’t work
- Should we trust the post globals?
- get comments and get posts in loop
- How to know if get_posts() failed?
- Count singular post views automatically
- Looping through posts per category gives same posts for each category
- How to have different content in the loop and single
- Specific loop in Shortcode
- Search widget breaks when using multiple loops?
- How to Replace the WordPress Featured Image with a Video?
- Display Latest Post from all Categories
- WordPress theme ajax have_posts()
- custom wordpress post loop – hide iframe content
- Divide Loop Into Days & Categories
- How to load a different header based on post format?
- While in “the loop”, detect if a post is the most recent
- Understand post type
- Mark menu item as current-menu-item for category
- Understanding and using metaboxes in posts
- How to display different number of posts
- If Specific Post, Link Elsewhere
- How to filter posts that belong to a specific category only if that is the only category
- WP Query – duplicated posts once including tags in search results
- Most recent post from another database
- wp_tag_cloud() and the_taxonomies() work but not the_tag()
- Show all posts in sidebar in single.php
- Split WordPress Latest Posts in Multiple Columns and Rows with one single loop [closed]
- Avoid duplicate post from same Taxonomy
- Replace ‘published on date’ with ‘modified on date’ on Posts
- Alternate row and columns every X posts
- Best way to assign post position in a news site homepage? (no categories, no sticky posts)
- How do I restart my loop with get_next_post()?
- Child_of not displaying all children posts.. via get_posts
- How to display the link (title) and thumbnail post?
- Posts will not display on page-mypage.php
- Trying to use AngularJS with WordPress without any API
- Pagination with an array of post objects?
- How do I stop the loop from repeating in my category template?
- Remove Content after
- Get Value of Post before
- Multiple Loops Breaking Pages
- Second get_permalink inside loop points to wrong URL
- Admin – no Featured image choice in create new/page|post
- Change image size depending on page
- Use Click Image to Play Youtube Video in a WordPress Loop
- How can I use the WordPress Loop and Pagination in multiple instances but different scenarios throughout my site?
- How to only publish posts with image in it
- Why this function doesn’t works without the_post?
- home.php show blog posts as grid view
- Optimizing the blog loop
- Accessing Post ID Within Loop
- Different number of posts per row in grid layout
- linking to post outside the loop
- first excerpt fine, subsequent post excerpts shift to the right instead of displaying vertically [closed]
- WordPress Architecture as a CMS – Posts & Pages
- Defining ‘last’ class on foreach blog posts
- List categories of a post hierarchically?
- Want to change the post every three days with in specific category
- Add a field in my rest api
- Problem paginating a subquery on a post
- Numbered Pagination Showing The Same Posts After Altering WP_Query
- “read more” redirects to the wrong page
- How can I get the last post while on the first post for pagination? As if it were infinite
- Posts only showing on /localhost/wordpress/ and not on other pages
- Display the latest post from some selected authors
- Advanced Post Display/Pagination/Ordering
- Keep post format class with isotope filter
- WP Knowledge Base Theme bug – Subcategories and Articles, Need to change WP_Query
- Make assigning post to a specific category equivalent to assigning it to all categories
- How do I get the WordPress post to display the content instead of an image?
- Displaying posts on Homepage
- Where are my posts linked to? I keep getting a Not Found Error, and I have no single.php page
- Automatically delete default posts and pages on theme install?
- WordPress posts loop pagination – first page return 125 posts instead of 10 and the rest return 10
- How do I show the post title if an advanced custom field hasn’t been used?
- Custom post order returning posts from other categories
- CSS code for “inserting a custom post divider” after each post