Get post meta (date) outside loop
-
Hi,
I have a variable called ‘today’ and I’m using this to list events on date. I have added a custom meta field called ‘event-days’ to add extra days to variable ‘today’.
But it doesn’t work.
Note: it’s located outside the loop and that’s why I call the wp_query for the ‘event_days’.global $wp_query; $postid = $wp_query->post->ID; $event_days = get_post_meta( $postid, 'event-days', true ); $now = strtotime('today'); if ($event_days == 'two') { $today = strtotime($now . "+1 day"); } else if ($event_days == 'three') { $today = strtotime($now . "+2 days"); } else if ($event_days == 'four') { $today = strtotime($now . "+3 days"); } else { $today = strtotime('today'); }
Suggestions? I think it might has something to do with being outside the loop.
Guido
Viewing 11 replies - 1 through 11 (of 11 total)
Viewing 11 replies - 1 through 11 (of 11 total)
- The topic ‘Get post meta (date) outside loop’ is closed to new replies.