Got it
<?php
query_posts('posts_per_page=2' . '&paged=' . get_query_var('paged'));
if (have_posts()) : ?> <?php while (have_posts()) : the_post();
?>
as simple as that.
Related Posts:
- Custom loops, sticky posts, and pagination nightmare
- Ensuring sticky posts are retrieved first (without using two queries)?
- Limiting query_posts to 1, regardless of sticky post?
- How to make “sticky” pages (and query by them)
- Pagination on archive.php page
- Having trouble generating pagination links on custom query
- Schedule Sticky Posts
- query_posts and pagination, still stuck after much research
- how could I get the pagination as I want to when query posts using get_posts function
- pagination in author.php template returns 404 error
- How do i paginate query_posts with numeric pagination?
- Pagination on custom query
- Custom posts per page does not work with pagination
- WordPress pagination showing same posts on each page
- WordPress pagination with get_posts?
- Using ajax with paging and a custom sub-query
- Querying posts only if the current page is not paged?
- Exclude current sticky post
- query_posts pagination will always show identical content
- How do I use pagination in WordPress?
- Pagination linking to first page
- Sticky posts don’t show up first in custom loop
- Custom loop off by one post
- Modify main loop query for paged and meta key
- wordpress query_posts featured page always on top
- Post Filter clearing on pagination $_post
- get_next_posts_link() stops displaying at page 4
- WordPress loop problem: Multiple loops, index.php and is_paged causing duplicate posts on next page
- Multiple loops with / without sticky posts and different post limits
- Achieving pagination with `query_posts`
- posts_per_page no limit
- Query posts: how to exclude results if post is in multiple categories
- query_posts ->using meta_compare / where meta value is smaller or greater or equals
- Is it better practice to use query_posts, WP_Query, or get_posts to create various custom loops within a Page?
- WP 5.8 “Query Loop” block: where to place custom query?
- Sort X categories by last update and show image
- order post my meta value m/d/y format with year as included value
- _wp_page_template to dynamically use template
- Total Count of Posts NOT in Selected Categories?
- Problem with single-page for my custom post
- How to modify the query to exclude posts by slug?
- How to make the list of post and load on same page with sub-pages [closed]
- How to get 4 Posts after the 5 most recent ones
- How do I make archives.php for one category only?
- get_meta_data within a loop
- making random query button using $_GET
- Is it possible to query_posts using post__in and then Loop through them in the ordered they were queried?
- How do I change the default sort order of a custom column on the posts page?
- how to exclude “featured” posts from the main loop?
- Five posts from a category in footer
- 3 Posts in Loop, Show Stickies First
- Order posts by condition
- Co-authors plus problems with query_post
- Search breaks when querying main loop for category
- Authors List page – How to include only those with wp_user_level as Author
- Blog post per page setting conflicting with custom WP_Query?
- Query posts by meta_key whose value is an array
- Show Blogroll of another WordPress site
- Why this code causes infinite loop?
- Each post is showing twice in my custom query…?
- query_posts() – problem with “s” parameter
- Pagination on category.php and tag.php not working
- Page title in post query
- Question about querying posts
- Pagination for query_posts();
- Breadcrumbs stop working on a specific template file
- Does WordPress run a post query when a page is invoked?
- Multiple posts/pages in one page?
- Order for custom field after the loop
- Custom post query error
- Multiple instances of query_posts
- Different layout based on post amount?
- If Query Post Returns 1 Post
- Keeping get_posts’ offset and is_paged() synchronized
- odd behaviours from template tags
- How do I add a timezone offset to this query?
- query_posts thumbnail condition
- Show posts from specific roles
- How to get any type posts include attachments by ids?
- Create a Loop with Posts Ordered by Most Recent Comments
- Tax query get first product with attribute value in pre_get_posts
- Specifying image size used in template the_content
- allow user to edit posts made by others users based on the user role
- Pagination does not work with query_posts()
- Pagination not working on my archive page for a custom post type
- No duplicate tags by category
- Order posts by ACF checkbox
- Post per page not working
- Show previous month’s posts
- query_posts result differs from wp_query request result
- How to inject a post within a loop
- orderby not working for query_posts using array of IDs
- Collect posts from last 48 hours
- How to go to tag archives using a form
- Showing one post from each category, paged?
- query posts returns 10 records
- Sort posts with multiple meta_keys
- How to get custom post type posts with certain multiple tags names and category id?
- Create “archives by year and week” by category template
- query_posts different amount of posts per page [duplicate]