Change month automatically in get_page_by_path
-
Hello
I want to display the opening hours of a theme park with Advanced Custom Fields. The hours are in custom fields and I want to display tomorrow’s hours. I wrote the following codes:
Code 1
This code displays ‘juli-2015’, which is the current month.<?php setlocale(LC_TIME, 'NL_nl'); setlocale(LC_ALL, 'nl_NL'); $maand = strftime("%B-%Y"); echo $maand; ?>
Code 2
This code displays the hours with the custom field, for tomorrow (20 July 2015) the hours are ’10:00 – 19:00′ and the code displays that.<?php $dag = date('d', strtotime($datum . "+1 days")); $page = get_page_by_path('openinghours/juli-2015/'); $pageID = $page->ID; $id = $pageID; the_field("dag-$dag", $id); ?><?php } ?>
The thing is that the ‘juli-2015’ in the second code needs to change automatically with the current month (which is code 1). So the two codes need to be one, but when I replace ‘juli-2015’ with ‘$maand’, it says error.
Anyone please? ?? Thanks!
- The topic ‘Change month automatically in get_page_by_path’ is closed to new replies.