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
- Add a category to posts, that DO NOT contain two specific keywords?
- why does wordpress ignore the post args?
- Dynamically switch template on click
- How to get posts and comments amount per hour, per year and per month?
- While loop articles – if statement order
- post category in wp_insert_post
- Get all custom post types excepted some…
- Limit the number of posts a category can have – newest post goes in, oldest one drops out, possible? plugin?
- Get all comments of author’s posts
- First x post with another template then the others
- Why Query is returning empty array?
- How to get subcategories from category slug?
- Remove current category from post but display all others
- How show categories in admin and get that selected to show posts in index
- Delete all drafts?
- Showing categories and subcategories with posts
- Change default category when I publish a post
- Wrap every month posts in div
- store posts_id of category into a varable?
- Inner join overrides Advanced Custom Fields plugin’s get_field [closed]
- meta_value timestamp older than now
- Counter is skipping post when I still want it visible [closed]
- How to display two random-post sections that are each under their own category
- How can you display all sibling categories to a post?
- Changing default WP-Site creation date
- Loop doesn’t exclude the specified category in home page
- Do not show children of a category
- Make a vertical dynamic list of posts in alphabetically order and in columns [closed]
- post__in not working with pre_get_posts, but post__not_in does work
- Display posts of specific category term
- Create a list of posts with topic headdings
- Widget that shows categories with posts numbers
- How to create a sub post?
- Post Image not displaying in category view
- Can’t get full post title if there a spaces in title
- How to get all post_parents of a post?
- How do I show posts from another wordpress installation?
- Query for first 3 posts to change the look and feel
- How to get posts published on the latest date?
- Why posts array is empty?
- get posts from Custom Post Type & Category
- Category page when using static front page
- Latest posts by category — how to exclude current post?
- Query posts and filter at query time by value of custom meta
- Run query_posts if SESSION is empty?
- How do I include the category next to the title of a post?
- Relative number of post in category
- How can I add a box to edit Order on a regular post?
- How to create a “latest news” page showing a list of posts from blog category
- WordPress bulk category select when publishing post
- Exclude some categories from listing on the current post
- How to show a custom taxonomy in the theme?
- How to import nested categories from XML file?
- Very complex post query
- how to hide empty fields of post category description?
- Delete post revisions only for a single post
- how can i display my posts alphabetically?
- if in category but only with post meta
- How to get post with associated categories and tags names instead of ids with rest api?
- What date to use as a post date? date_gmt or modified_date_gmt
- Display a mixed list of posts and media
- Migrate posts from category and sub-category via SQL
- Parent category / child category posts
- Posts Missing in Dashboard after update
- How to enable custom Shortcodes in Post Category Description? [duplicate]
- How to give classname to post if post has no content?
- Display post by click on the link
- How to update all posts at once?
- Sort by last word in title
- Display post number by category