• Resolved daelemans_m

    (@daelemans_m)


    Hello

    I’ve made a calendar system where each month has his own page. If the page name equals the current month, the month page doesn’t need a header and footer.

    I’ve already made that codes, but I am searching for the if-clause ‘if page name is current month’.

    Is there a way to use date('m') to check if the month page is the current month?

    This is the if-clause: (the 'July 2015' has to change automatically)

    <?php if (is_page('July 2015')) : ?>
        MONTH PAGE WITHOUT HEADER AND FOOTER
    <?php else : ?>
        FULL MONTH PAGE
    <?php endif; ?>

    Thanks a lot! ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • https://php.net/manual/en/function.date.php

    try:

    <?php if ( is_page( date( 'F Y' ) ) ) : ?>
        MONTH PAGE WITHOUT HEADER AND FOOTER
    <?php else : ?>
        FULL MONTH PAGE
    <?php endif; ?>
    Thread Starter daelemans_m

    (@daelemans_m)

    I just tried and that gives me the header and footer as well.

    Maybe I have to say that the page titles are in Dutch (I changed it in my first post in this topic because this is an English forum). If I echo the code you just gave me, it says ‘July 2015’ and I need ‘Juli 2015’.

    Thread Starter daelemans_m

    (@daelemans_m)

    I works! I changed the language into Dutch and made the first letter of the month uppercase.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘If page title is current month’ is closed to new replies.