Pass Paged
into parameter array of query_posts
You should set get_query_var( 'paged' );
if you want your query to work with pagination.
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args_news= array(
'cat' => 1,
'posts_per_page' => 2,
'orderby' => 'post_date',
'order' => 'DESC',
'numberposts' => -1,
'paged' => $paged,
);
query_posts( $args_news );
if ( have_posts() ) :
while ( have_posts() ) :
the_post();
the_title();
the_content();
endwhile;
endif;
for more information:https://codex.wordpress.org/Pagination
Related Posts:
- When to use WP_query(), query_posts() and pre_get_posts
- Nested meta_query with multiple relation keys
- WP Query where title begins with a specific letter
- WP_Query vs get_posts
- Using OR conditions in meta_query for query_posts argument
- Order posts by ID in the given order
- Query Multiple Post types each with own meta query
- Get posts by menu ID
- Get the number of posts from the current page results
- Query Custom Meta Value with Increment
- How to know which one is the main query?
- get query’s query string
- Meta Query with date and time on the same Day before given time
- Multiple search queries on one page
- How to show only one post for each categories of taxonomy of custom post that contains a specific custom field
- How do you query wordpress posts using a math formula between multiple meta field values?
- How add a custom posttype name using ACF field to a query post array
- Page navigation doesn’t show when query category
- 2 loops on page – one with orderby rand second orderby date
- How to query a custom post type with a taxonomy filter but display post type archive page?
- WP Pagination on Posts Search Results Page resulting from AJAX WP Query
- Five posts from a category in footer
- Change query_posts to WP_Query in page but does not work
- How can I create ‘future’ and ‘past’ parameter for restAPI by filtering the CPT custom date field by greater than / less than current datetime?
- Serve specific “template” page at any URL that ends in its slug
- How to display multiple custom fields with the same meta_key in an ascending order?
- new WP_Query(), have_posts() return false in user_register hook
- Slow page loads due to WordPress Core Query
- how to make members list directory through wordpress post custom meta key.
- Add class to first post in custom loop using post_class filter
- Some doubts about how the main query and the custom query works in this custom theme?
- How to exclude post formats from wordpress recent posts in a tabs widget [closed]
- How to increase load time of an archive/search page (WP_Query)
- Query Page Content From Theme Options?
- Query all posts if multiple meta key don’t exist
- Reset WordPress Post Query to default
- How to get all post except particular category without breaking the paging
- How do I rewrite this loop as a new WP_Query style-loop?
- Include current post into loop
- Filter Custom Taxonomy Posts
- How to provide meta_key array to wp_query?
- Easy way to write complex queries in wordpress
- Filter post query to only show direct children of category
- Order post type by sum of two custom fields
- get_posts output always same post
- Query_posts works when appending via AJAX call wp_query doesn’t?
- Use WP_Query or query_posts() or get_posts() for optimizing a site?
- How to make posts unqueryable/unpublish posts where ACF relationship field is an unpublished post? [closed]
- Posts Query | Query to only show sub categories
- How do I add a relation parameter to my filter query?
- Get next/prev image/attachment in time with date query
- Show single posts date, in a page of posts
- specific post is not excluded from the loop
- Why doesn’t my WP Meta Query return any results?
- Paginate pages with dynamic query
- filter posts by meta key with pagination
- Trouble Making WP_Query paged
- Performance concerns: index.php vs taxonomy-$taxonomy.php
- Determine if ID is page or post and query the ID
- Custom template for password protected page
- WP_Query Class custom field parameters
- Add AJAX “Load more” on custom query block
- Posts limit on homepage (genesis framework)
- Optimising WP_Query with ACF Fields
- Elementor posts custom query based on tag [closed]
- Filter products on category AND tag
- Facing problem with tax_query results
- How do i create a custom post query when the meta value is an array?
- How do I stop the same post showing multiple times in a archive?
- Get posts that match defined arrays of tags
- Query for current post
- Custom query to retrieve oldest post and retrieve others with date interval
- trying to change from query_post to WP_Query
- How to query most recent post for each author?
- I need query_posts() to order results first by a meta value and then by post ID
- WordPress For Loop Prints Unwanted Extra Paragraph Element
- How to search CPTs in draft using get_page_by_title()
- How to show post title in content editor in backend?
- Orderby query does not work for custom fields even with meta query
- Custom WP_query and integrating into theme file
- Pull posts from all categories if quantity is not met?
- Query_post 5 post first / last of post_id
- query_posts() doesn’t seem to be called in my page
- Some doubts about how the main query and the custom query works in this custom theme?
- Fetching $_POST from Page Template into functions.php
- Ordering Posts by parent category, name ascending
- Optimising specific Query with ACF meta objects
- How to organize a WP_Query’s list of posts by category and display category title?
- query_posts with sorting on a custom datestamp
- query post based on comparison
- Converting an existing query_posts to WP_Query
- WordPress Query showing multiple titles
- Query Posts by date range with fixed beginning and end
- Multiple loop for “featured” items returns wrong posts
- Having trouble using this post category query on multiple pages?
- Query Posts to fetch Posts with Unique Tag
- query_posts problem – need help
- WP Query – Show custom posts only if user contain some user meta
- Show number of posts AND number on current page (cannot make it work)
- new WP_Query with order args – no more distinction between categories