Support » Plugin: Events Manager » [Plugin: Events Manager] conditional placeholder question

  • I want to show a text only for today and future events and hide it from past events so I used the conditional placeholder {is_future}. However, it doesn’t do the trick for today events. It treats it as past.

    Any idea how to do this correctly?

    Or can the {is_future} conditional placeholder include today events as well on the plugins nextupdate?

    http://wordpress.org/extend/plugins/events-manager/

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Marcus

    (@netweblogic)

    NetWebLogic Support

    check your blog timezone, future is calculated according to the start day and time of the event.

    My blog timezone is correct. Is there a way to hide a text or a block of code if it is in the past?

    Plugin Author Marcus

    (@netweblogic)

    NetWebLogic Support

    what about when you try to use is_past ?

    Plugin Author Marcus

    (@netweblogic)

    NetWebLogic Support

    btw, just tested this and it works fine for me.

    I tried is_past. It also hides the text of the today event. I don’t want it to do that. Text of today and future events I don’t want to hide. Only the text of the past events.

    Hope this snippet could help you; (modify as needed) paste to your theme functions

    usage:{is_today_future}..{/is_today_future}

    add_action('em_event_output_condition', 'my_em_styles_event_output_condition', 1, 4);
    function my_em_styles_event_output_condition($replacement, $condition, $match, $EM_Event){
        if( is_object($EM_Event) && preg_match('/^is_today_future$/',$condition, $matches) ){
            if( strtotime($EM_Event->event_start_date) >= strtotime(date("Y-m-d")) ){
                $replacement = preg_replace("/\{\/?$condition\}/", '', $match);
            }else{
                $replacement = '';
            }
        }
        return $replacement;
    }

    It works! Thanks for the code.

    that’s great.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Plugin: Events Manager] conditional placeholder question’ is closed to new replies.