You just need get current date and add it on data_query in wp_query, Look this:
<?php
$getdate = getdate();
$args = array(
'date_query' => array(
array(
'year' => $getdate["year"]
),
),
);
$query = new WP_Query( $args );
?>
and then use loop:
<?php
if ( $query->have_posts() ): while ( $query->have_posts() ) : $query->the_post();
the_title();
the_content();
endwhile; endif;
?>
Related Posts:
- Different post sort order within different categories
- How to put last edited entry on top of the blog-post list?
- How to sort posts by last name (2nd word) on ONE category only?
- How to choose a sort order (for posts) per category? (ideally when creating a new category)
- Order post by year DESC and month ASC
- Display custom post types by date field
- How can I display a specific user’s first published post?
- How to set post expiration date and time and move the page to archive after expiration [closed]
- Display posts in alphabetical order for a particular category
- WordPress custom Query for Posts in Category display posts multiple times
- How can I setup a relationship using categories in WordPress?
- date issue with category post retrival
- Retrieving posts by their date and category
- How to display only one category in a custom post type?
- Adjust the order for returned posts
- Order posts by date
- Get current taxonomy and display query accordingly
- Need to display a Jan 1st post as the site’s front page on Jan 1st, and Jan 2nd post as front page on Jan 2nd etc
- AJAX load more posts not using correct category and repeating the same few posts
- How do I display posts ordered by a date custom field?
- How to run select query of post with category and tags?
- Querying posts from current category, using a variable as array argument
- Query posts from newest category
- Query post for today, if no post get the previous one
- Query post category & remove any post id
- How to organise post by category and date
- Sort post by category using HTML Select tag
- Last three posts not being put in order by date. How to fix this?
- Sort Posts Alphabetically Based on Specific Category (Divi)
- How to sort posts alphabetically based on a specific parent category
- How to get post creation date?
- Get current menu_order
- How to add category to: ‘wp-admin/post-new.php’?
- Use category base slug in posts’ permalink
- Setting Custom Sort Order of Posts within a Category
- how to get a different html for odd/even posts?
- How to show list of posts by author and category?
- Exclude posts that only have the ‘Uncategorized’ category [duplicate]
- get_the_term_list by hierarchy order
- How to change the layout and styling of posts according to their category in WordPress?
- display sub categories assoccited with each post in a category archive page
- How can I specify a category post on my home page
- Trying to put an array into ‘post__in’ => array() query not working
- Use template of parent category for single post sub-categories
- How to search only by post title and category?
- Permalink Settings: optional settings doesn’t apply to editor
- Search query – exact post title match
- Display posts from #6 to #20 on archive page
- How to start with post number x?
- I want to show category in the post title , how can I do
- Random post category URL
- How can i sort the categories by ID
- Automatically republish old posts
- Add ajax load more function using WP API
- Properly display posts on homepage
- How can I show many posts an author has per week?
- Display post X of Y in category
- Exclude category from
- WordPress Sidebar menu for posts based on date – guidance needed
- WordPress Multisite – Create Default Post and New Category On New Site Install
- Using ajax on editing a category edit page?
- Disable sticky option for specific categories
- How to make multiple sections in home pulling posts category wise?
- How to get posts and comments amount per hour, per year and per month?
- How to get subcategories from category slug?
- Loop doesn’t exclude the specified category in home page
- Post Image not displaying in category view
- Parent category / child category posts
- How to update all posts at once?
- Getting an extra post’s meta data?
- displaying the categories post
- What’s a theme that properly handles previews of different types of posts?
- WordPress, custom post type and posts query help!
- How to add content above footer in posts from specific category
- WordPress – When visiting a `single post/ single.php` my category menu item link becomes active
- Ignore posts content in the posts queries for internal linking
- How to create a button to filter posts (list) by meta value
- Is there a way to save different data when USER interacts with the same POST?
- How to display particular categorie’s post which associated to specific user?
- Display Specific Categories posts on the home page
- show only one category and filter by tag
- Code to display random ordered posts in Categories across pages [duplicate]
- How can I exclude only a specific sub category post from category display?
- how to print total number of posts filtered by category?
- Compare date of user’s last posts
- Add category information beneath post?
- How to make post button to a random post
- Where is object, property or label in the database that controls the order of the posts being displayed?
- Newly created category does not show category
- Show a Category Specific Info Box
- Special Query: Title, Terms, Content – %LIKE%
- Display the first post’s comments of category in comments.php template
- How to display a certain template element only for posts published within certain time range?
- wordpress show category link instead of post link [closed]
- CSS – Change height of Storefront / WooCommerce product categories, but not products
- How to set value in Query Loop?
- Wp_query WooCommerce products
- How to display my categories in a list (to a post, not the sidebar)?
- Site ‘Categories’: save an admin global setting with post metadata [closed]
- Exclude posts by date – related post