My plan is to make a Date search form, but i need to query the post date while searching because for example if i search august 13 it will show nothing,
How can i search the post date of the post
Im Using this code but nothing happens i tried reading this article https://developer.wordpress.org/reference/functions/query_posts/, im very sorry im new on wordpress and php, and learning thank you,. I think this is wrong
<?php
global $wp_query;
$args = array_merge( $wp_query->query, array( 'posts_per_page' => 12,
'year' => $current_year,
'monthnum' => $current_month,
'order' => 'ASC' ) );
query_posts( $args );
$x = 0;
while (have_posts()) : the_post(); ?>
and this is my ordinary search
<?php
global $wp_query;
$args = array_merge( $wp_query->query, array( 'posts_per_page' => 12 ) );
query_posts( $args );
$x = 0;
while (have_posts()) : the_post(); ?>
You should try something like:
<?php
$year = '1365';
$month = '03';
$day = '30';
$search_date = new WP_Query( 'year=' . $year . '&monthnum=' . $month . '&day=' . $day );
if($search_date->have_posts()) : while ($search_date->have_posts()) : $search_date->the_post();?>
<a href="<?php the_permalink(); ?>">
<?php the_title(); ?>
</a>
<br/>
<?php endwhile; endif; ?>
This will show a simple list of title with links of the posts from 1365.03.30