I have a function to get the date. I have input fields and want the date in this fields. But my code is set a wrong date. I set the date in Wordpress settings and on my server. But it is not working. This is my script:
function get_agenda_item_day() {
global $post;
$cp_date = get_post_meta($post->ID, 'cp_date_end', true);
$cp_date_arr = explode("-",$cp_date);
$day = $cp_date_arr[2];
return $day;
}
And i use this in my select tag:
<?php $day = get_the_time('j'); ?>
<select name="ad" id="ad" onChange="getNDay()" class="select select-n">
<option <?php if($day == 1) {echo 'selected="selected"';} ?> value="1">1</option>
<option <?php if($day == 2) {echo 'selected="selected"';} ?> value="2">2</option>
<option <?php if($day == 3) {echo 'selected="selected"';} ?> value="3">3</option>
<option <?php if($day == 4) {echo 'selected="selected"';} ?> value="4">4</option>
etc etc etc
</select>
But, what do i wrong. Always the date is 17 juni in the select box. Because today the date is 5 Juli.
Thanks for help