Try using paginate_links( $args )
. Here is code adopted from codex.
$paged = ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1;
$args = array(
'posts_per_page' => 30,
'paged' => $paged,
);
$the_query = new WP_Query( $args );
// the loop etc goes here..
$big = 999999999;
echo paginate_links( array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'format' => '?paged=%#%',
'current' => max( 1, get_query_var('paged') ),
'prev_next' => false,
'total' => 3
) );
See detail here on codex.
Related Posts:
- Posts with at least 3 tags of a list of tags
- Get post count of current loop when using multiple queries on one page
- How do I query for posts by partial meta key?
- Display products from specific category in shop page
- How to uniquely identify queries?
- Use WP_Query with a custom SQL query
- Pagination not working for Custom search form & custom result template
- Query by meta_key and order by meta_value_num return orderby date
- How to use filter hook posts_join for querying taxonomy terms in posts_where?
- Using AJAX to return search form results
- Add custom search results to main WP search [duplicate]
- What is the difference between RELATION “AND” and “OR” in TAX_QUERY?
- Finding post content that begins with a specific character
- Query Set Order By Author
- ‘&’ causes an error in my shortcode when I list the content of the page
- wp_query, give first post different formatting
- SQL Query inside Widget
- meta_query works locally but not on live server
- getting posts and number by specific meta value in multiple meta
- Use ‘parse_query’ filter to show posts that from multiple criteria
- How can I pick a single post from the latest 3?
- Retrieving list of a custom post type in a widget without using WP_Query?
- Get posts for last working week in WP_Query
- How to orderby meta_value_num with dollar ($) sign
- how to link to detail page(single.php?) in a wp_loop
- WP_User_Query unable to retreive all user at once
- Order WP_Query by multiple fields, subtracting them from one another
- How can I convert results of WP_Query (of Custom Post Type, with Custom Fields) to JavaScript?
- How to order posts in wp_query by the user role (2 roles in array)
- Meta Query Array Error 500
- getting post thumbnail within loop causes an error
- Reset postdata to custom query in nested queries
- Complex WP SQL Query
- Hide Administrators From User List except current user (administrator)
- Custom Query num_rows returns wrong amount
- How to figure out redirection and contents in hybrid solution containing word press content and legacy code (ASP.net)
- Category applied to pages, creates multiple breadcrumb entries after a search query (On the translated site)
- Most commented post showing 2 records
- How to store and receive variables in WP sessions?
- Add posts to WP Query object
- How to list posts with disabled/closed comments, with pagination?
- Category ‘pad_counts’ & ‘parent’ conflict
- How to not display tags with less than X posts
- WP User Query with Custom Fields and Search Results
- Order or Orderby in tax_query (How to define order of terms in WP_Query)
- Wp_query with 2 meta keys and array of meta values
- How to exclude Sticky from Recent Post?
- Display if author page is author page of current user
- Create a loop on my pages with new “WP_Query”
- Which meta_query and post_content blend is better in WP_Query, performance wise?
- WP_Query order by not working properly due to category I believe
- get_query_var always returns the default value
- WP ForLoop to compare meta information of posts to determine what post to display
- Problem with get_page_by_path() using with WP_Query
- Modify WP_Query using pre_get_posts but only for frontend query?
- Multiple wp_query on archive page
- When listing child pages run out of memory
- Function to retrieve IDs of posts, cache results, and improve wp_query
- parse_tax_query causing Navigation Menu To Disappear
- WP_query is not returning the expected result
- the_post_thumbnail do 2 queries. How to optimize
- wp query meta value is not null
- Trying to use WP_Query to display a custom post type
- WP Query / Meta Query [duplicate]
- Search.php – return number of results but cannot loop through
- Creating ‘posts page’ loop based on the page itself
- How to get pages of parent (non-recursive)?
- WP_Query and pagination AGAIN?
- Can’t get term id for category archive
- Combine query in WP_User_Query()
- Nearby locations using Advanced custom fields, maps?
- How to display the category dropdown auto search list when key press?
- order by post date and modified date posts both in wpquery
- Comparing Meta Field date in WPQuery using Meta_Query?
- How to get_comments() ordered by date and parent?
- WPQuery loop not giving expected output
- WP Query filters active on wrong query
- Not able to fetch woocommerce variation sales products for particular category products
- Global page ID variable empty error
- Query postmeta based on meta_value, return array of post_id
- WordPress tax_query ignoring relation OR
- pagination functions are not working
- Gather same custom field values in one value in a select tag with wp_query
- datetime picker, timestamps and meta queries
- Meta key in wp_query bug?
- Order Posts By Youtube Views
- WP Query with sticky posts and tax_query
- How can I create another instance of my custom shortcode
- How To Call WP_Query From A Subdomain?
- Declare inline background image in functions.php
- WP_Query for attachments without duplicating post_parent and displaying tagged image
- Looking for a way to exclude frontpage and nav menu from query filter
- Query posts by custom fields
- Showing posts from 4 categories along with all latest posts
- Searching in specific custom post type
- WP Query Obj: Set value to be unequal | Hide media by admin
- WordPress pagination returns the same posts
- How do I have multiple metaqueries inside one wordpress query
- Query All Posts: Either Display Most Recent or One with Particular ACF Value Chosen
- Can I use WP_Query to find a post with a particular menu_order?