Events Made Easy Forums Generic links on calendar widget

  • This topic has 6 replies, 2 voices, and was last updated 10 years ago by Anonymous.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #52009
    Anonymous
    Inactive

    Hi,

    Why the Calendar Widget Events links are different from the Events list widget ones?

    I’ll try to explain a little better….
    I have the Calendar Widget and the Events list Widget on my sidebar. There is an upcoming event on 26th…

    The event link on the calendar is pointing to: http://www.elsamarrero.com/events/2014-04-26/
    the same event link on the Events list is pointing to: http://www.elsamarrero.com/events/17/el-arte-de-la-seduccion/

    The destination is the same but I’m using the function “eme_is_single_event_page()” to recognize that the current page is an event page. But if click to the first link it doesn’t recognize as an event page (eme_is_single_event_page() returns nothing, using the second link returns 1)

    How can I change the links on the calendar to be the same as the events list widget.

    And if its not possible how can I recognize as an event page this kind of url: http://www.elsamarrero.com/events/2014-04-26/

    Please let me know.

    Thanks

    #52011
    Franky
    Keymaster

    The calendar points to the day having events, not the event itself. If the day only has one event that event will be shown immediately, otherwise a list of events on that day will be shown.

    Edit: concerning your second question: use “eme_is_events_page()”, that should work then.

    #52013
    Anonymous
    Inactive

    Thanks for the reply Franky.

    using “eme_is_events_page()” works fine and I recognize as an event page now… the problem is that I need to get the event ID. ($event_id = $wp_query->query_vars[‘event_id’]). And I amb not able to do it on the first url… 🙁

    any ideas?

    #52014
    Franky
    Keymaster

    Maybe we should take a step back here: what are you trying to accomplish? And are the available EME hooks and filters not enough in this case?

    #52020
    Anonymous
    Inactive

    Ok,
    What I want to accomplish here is to show the RSVP form into the sidebar on each single event page…

    So What I do is placing that code in the sidebar php archive.

    if(eme_is_single_event_page() || eme_is_events_page()){?>
    <h3 class=”widget-title”>RSVP Form</h3>
    <div class=”registerFormContainer”>
    <?php
    $event_id = $wp_query->query_vars[‘event_id’];
    echo do_shortcode(“[events_add_booking_form id=" . $event_id . "]“);
    ?>
    </div>
    <?php }?>

    Works perfect, but as I said, cannot get the ID on the first url… (http://www.elsamarrero.com/events/2014-04-26/)

    Hope I explained well…

    #52021
    Franky
    Keymaster

    Well, the reason I explained already above.
    To get the event_id in both cases (small remark: use get_query_var(), it’s easier), I’d do this:

    
    if (eme_is_events_page()) {
          $event_shown=0;
          if (get_query_var('calendar_day')) {
             $date = eme_sanitize_request(get_query_var('calendar_day')); 
             $events_N = eme_events_count_for ( $date );
             if ($events_N == 1) {
                $events = eme_get_events ( 0, eme_sanitize_request(get_query_var('calendar_day')));
                $event = $events[0];
                $event_id = $event['event_id'];
                $event_shown=1;            
             }
          }
    
          if (!$event_shown && eme_is_single_event_page()) {
             // single event page
             $event_id = intval(get_query_var('event_id'));
           }
    <DO YOUR STUFF WITH $event_id >
    }
    

    I admit that it is not very efficient, but without code changes there’s no other option.

    #52022
    Anonymous
    Inactive

    enough for me!
    Works perfect. U saved my day.

    Thank u very much!

Viewing 7 posts - 1 through 7 (of 7 total)
  • The forum ‘Generic’ is closed to new topics and replies.
Scroll to Top