• Resolved marisoplete

    (@marisoplete)


    Hi there! I need to detect if a page is the main event page or not. Is that possible?
    Thank you in advanced!

Viewing 5 replies - 1 through 5 (of 5 total)
  • What do you mean exactly? “The main event page”. Do you mean “is this an event” or “is this the events list”?

    Thread Starter marisoplete

    (@marisoplete)

    Hi Patrick! I mean “is this the events list”, but the page set as default for this reason, not every page with an event list. For example, the page which is loaded when you click in the calendar widget and there are more than one event per day.

    Thanks!

    You mean the page set here, in this dropdown?
    Events > Settings > Pages > Event List/Archives > Events page

    There are several ways to do that:
    https://developer.www.ads-software.com/reference/functions/is_page/

    If you know the page ID: is_page(3)
    If you know the slug: is_page('slug')

    Or to let WordPress find it for you:
    is_page( get_option('dbem_events_page'))

    So, the complete(r) code would be:

    <?php
    if( is_page( get_option('dbem_events_page') ) {
        // Do stuff if is yes.
    } else {
        // Do stuff if not.
    }
    ?>
    Thread Starter marisoplete

    (@marisoplete)

    Hi Patrick!! Thank so much!! ??

    Thread Starter marisoplete

    (@marisoplete)

    Hi again! Sorry but this is not what I need. I thought it would but it isn’t. I’ll explain better what I need.

    I need to change the appearance of the list of events when I click in one day of the calendar widget and there are two events. I mean, now the page and the aspect is just the same, even the page ID to main event page; so all the conditionals dont’t work.

    Is that possible?

    Thanks! ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to detect in PHP if is main event page’ is closed to new replies.