Associate
I am not great with php and javascript. I get by, bit for example spent an 2 hours today chasing a syntax error.
Anyway. I am trying to put a line showing how many days (via countdown) until a speedway fixture on the front page our website. I want the next three fixtures showing at all times throughout the season. I have manged to make the php work on the first one but the next two show an error.
The loop
and the 'countdown' ...
The get_field is date-picker 'data' from advanced custom fields and changes for each fixture. This script is in the loop but will only output the first time. Is anyone able to make this work and explain it to me. I assume I have to make the $d1 $d2 increase each time to tie in with the number of articles showing ?.
I can't go by the article publish date as I have set the publish date to a year ago so they don't get 'scheduled' by wordpress.
I need them to not show after the time has expired. If thats difficult I can move them elsewhere when I input the results and match report.
Thanks in advance for any advice.
Anyway. I am trying to put a line showing how many days (via countdown) until a speedway fixture on the front page our website. I want the next three fixtures showing at all times throughout the season. I have manged to make the php work on the first one but the next two show an error.
The loop
Code:
<?php
$temp = $wp_query;
$wp_query = null;
$wp_query = new WP_Query();
$wp_query->query('showposts=3&orderby=date&order=asc&post_type=wcometsmeetings'.'&paged='.$paged);
while ($wp_query->have_posts()) : $wp_query->the_post();
?>
and the 'countdown' ...
Code:
<?php
$d1=strtotime(get_field('countdown_date'));
$d2=ceil(($d1-time())/60/60/24);
echo "Coming up in " . $d2 ." days";
?>
The get_field is date-picker 'data' from advanced custom fields and changes for each fixture. This script is in the loop but will only output the first time. Is anyone able to make this work and explain it to me. I assume I have to make the $d1 $d2 increase each time to tie in with the number of articles showing ?.
I can't go by the article publish date as I have set the publish date to a year ago so they don't get 'scheduled' by wordpress.
I need them to not show after the time has expired. If thats difficult I can move them elsewhere when I input the results and match report.
Thanks in advance for any advice.
Last edited: