/\*\*
\* Ajax Function to return the ids based on entered both from and to date - newly added
\*
\* @since 1.0.0
\*/
public function kiwimarket_ajax_calendar( $values ) {
$from_date = "";
$from_day = "";
$from_month = "";
$from_year = "";
$to_date = "";
$to_day = "";
$to_month = "";
$to_year = "";
foreach( $values as $key => $each ) {
$split_val_inner_chk = explode("-", $each);
if ($split_val_inner_chk[2] == "fromdate") {
$from_date = $split_val_inner_chk[3];
}
if ($split_val_inner_chk[2] == "todate") {
$to_date = $split_val_inner_chk[3];
}
}
if( $from_date ) {
$date_split = explode("/", $from_date);
$from_day = $date_split[0];
$from_month = $date_split[1];
$from_year = $date_split[2];
}
if( $to_date ) {
$date_split = explode("/", $to_date);
$to_day = $date_split[0];
$to_month = $date_split[1];
$to_year = $date_split[2];
}
$post_array = array();
$post_ids = array();
$setting = array(
'public' => true,
);
$output = 'objects';
$post_types = get_post_types($setting, $output);
foreach( $post_types as $key_val => $each_val ) {
$post_array[] = $each_val->name;
}
if( ($from_date) && ($to_date) ) {
$args = array(
'post_type' => $post_array,
'posts_per_page' => -1,
'date_query' => array(
array(
'after' => array(
'year' => $from_year,
'month' => $from_month,
'day' => $from_day,
) ,
'before' => array(
'year' => $to_year,
'month' => $to_month,
'day' => $to_day,
) ,
'inclusive' => true,
'compare' => 'IN',
'relation' => 'OR',
) ,
)
);
} elseif( $from_date ) {
$args = array(
'post_type' => $post_array,
'posts_per_page' => - 1,
'date_query' => array(
array(
'after' => array(
'year' => $from_year,
'month' => $from_month,
'day' => $from_day,
) ,
'inclusive' => true,
'compare' => 'IN',
'relation' => 'OR',
) ,
)
);
} elseif( $to_date ) {
$args = array(
'post_type' => $post_array,
'posts_per_page' => - 1,
'date_query' => array(
array(
'before' => array(
'year' => $to_year,
'month' => $to_month,
'day' => $to_dayr,
) ,
'inclusive' => true,
'compare' => 'IN',
'relation' => 'OR',
) ,
)
);
}
$result = get_posts($args);
foreach( $result as $key => $each ) {
$post_ids[] = $each->ID;
}
return $post_ids;
}
این تابعی هست که تاریخ رو میگیره. چون تاریخ شمسی هست، به عنوان میلادی شناسایی می کنه و نمایش نمیده. توی این کد شما چه تغییری می تونید بدید؟