• Resolved daelemans_m

    (@daelemans_m)


    Hello

    I wrote the following code to display opening hours using Advanced Custom Fields. This displays ‘juli-201510:00 – 19:00’.

    <?php $dag = date('d', strtotime($datum . "+1 days")); setlocale(LC_TIME, 'NL_nl'); setlocale(LC_ALL, 'nl_NL'); $maand = strftime("%B-%Y"); echo $maand; $page = get_page_by_path('plopsaland-de-panne/praktisch/openingsuren/juli-2015/'); $pageID = $page->ID; $id = $pageID; the_field("dag-$dag", $id); ?>

    But what I want is that the ‘juli-2015’ (from echo $maand) replaces the ‘juli-2015’ inside the get_page_by_path (which I wrote by myself). So the month in the URL has to change automatically.

    Anyone please? ?? Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi,

    If i understand You correctly, what You need is to pass $maand to get_page_by_path?
    You can try something like that:
    $page = get_page_by_path(‘plopsaland-de-panne/praktisch/openingsuren/’.$maand);

    Is it what You needed?

    Cheers

    Thread Starter daelemans_m

    (@daelemans_m)

    I tried $page = get_page_by_path('plopsaland-de-panne/praktisch/openingsuren/' . $maand . '/'); and that works.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Use $file in url’ is closed to new replies.