WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
[resolved] PHP variables? (4 posts)

  1. eundas
    Member
    Posted 1 year ago #

    Is it possible to use the plugin variables? I'd like to include in my events a small snippet of PHP code that will display a piece of text if the date of the event matches certain date but not otherwise. If I had a variable storing the date of the event this would be pretty easy but I browsed the documentation and was unable to find a reference explaining how to do this.

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

  2. agelonwl
    Member
    Posted 1 year ago #

    can I know where exactly you've wanted to add this? e.g. single events page? or conditional placeholder might help you also? http://wp-events-plugin.com/documentation/conditional-placeholders/

    http://wp-events-plugin.com/tutorials/

  3. eundas
    Member
    Posted 1 year ago #

    Conditional placeholders don't work because they invoke some function which produces some output but they don't contain the output themselves. Eventually I stayed awake for most of the night and solved the problem :-) For the record, I found that it is possible to do something like this:

    [Start example]
    global $post;
    $EM_Event = em_get_event($post->ID, 'post_id');
    $nmonth = date('m',$EM_Event->start);
    [End example]

    In this example what I'm getting is the date of the event for the current event being displayed. This is (third line) formatted so that $nmonth will contain the numerical identifier of the month (January=1, February=2, etc.). With this variable I can solve my problem. I guess this is pretty basic but may help somebody else.

  4. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    yes, this is perfectly fine to do!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags