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 posts published between a date and today?
- MySQL Query to Retrieve Category from wp_posts
- Sort posts by popularity/page views
- Category checkbox list tree changes when editing a post
- Rearranging posts based on categories
- List only child categories a post is in, of a specific parent category
- Add custom field to all posts in specific category
- How to output comments number of a post per day?
- wp_list_categories link to first post of category instead of calling taxonomy template
- How can I get all posts data from within a paginated search result?
- How only display all post related to category
- Add category to all post by using sql query?
- post re-order on my site
- Only display posts after current date
- Arrange posts by date in front page
- Full Width Main Post
- WP_Query Authors OR Categories
- Ordering posts by publish date not working?
- Pulling in post category and children within category
- get query() without post content?
- WP_Query: Mixing category__in and tag__in together
- How can I hide tags on a child-category page, if that tag has not been used?
- How do I stop the loop from repeating in my category template?
- post category in wp_insert_post
- store posts_id of category into a varable?
- Make a vertical dynamic list of posts in alphabetically order and in columns [closed]
- Display posts of specific category term
- Widget that shows categories with posts numbers
- How to get all post_parents of a post?
- How to get post with associated categories and tags names instead of ids with rest api?
- Display a mixed list of posts and media
- Assigning Two Different Post Dates For Single Post
- How to convert query sql to shortcode in wordpress?
- Sidebar limiting to 10 posts?
- How to list post as buch of category, and all of them
- Trim posts from WP-Query?
- How can I add a page that shows posts from a single category?
- Post date automatically +100 years into the future
- Remove subcategory slug from url
- Can I show category name in url for only one of my categories?
- Automatic duplicate/copy of post to a related page in WordPress
- Merge get_comments & get_posts into a single query
- Is there a way to categorize a list posts all at once?
- Change Old WordPress Post Date Year
- On the online version of my blog posts disappear
- Current post categories and subcatecories outside of the loop
- Query prints posts without specific categories
- Foreach issue in get_posts function
- Display Updated Date Instead of Published Date
- Re-order Category Meta-data
- Custom post styling per category?
- post categories – how to show only categories with a specific parent id
- Creating a “category” of featured posts
- How do I make it so that new posts within a certain category go into a certain page?
- My custom query is displaying random posts in random order
- Display the latest post from some selected authors
- Assign specific ads to specific categories/posts
- find posts with exactly 3/4 categories
- Displaying only posts from a certain category on my custom page template
- WP_Query: Fetch posts that are in (category1 and not in category2), OR posts that are not in cagegory1
- Make division in post_query?
- Add default content to post (for specific category)
- Display one post randomly from category on home page
- How can I get on the same row two post of different categories?
- how show post date for specific post?
- Filters do not work when there are multiple (one works)
- I am using the query block and what I want and see on the editor page is not the same with the actual results
- Error counting posts of category
- Display posts from a specific category on frontpage.php template?
- Cant display custom post type posts from a specific category WordPress