WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
[resolved] Events Manager v5.3 Placeholders Problem (9 posts)

  1. Stewart Barklem
    Member
    Posted 1 year ago #

    Upgraded to 5.3 and placeholders e.g #_LOCATIONNAME stopped working in the body of the event. So in the Single Event Settings I have ...
    <p>#_NOTES</p>

    <p>#_LOCATIONNAME
    #_LOCATIONADDRESS</p>
    .. and these display, but if I put these in the body of the event they now don't display and I get #_LOCATIONNAME instead.

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

  2. agelonwl
    Member
    Posted 1 year ago #

    Hi,

    I get this too however this might not be a bug since it's working in events > formatting and/or emails but I've let Marcus know about it.

  3. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    This is due to a recent change/fix to how placeholders are used in the description of an event. since you can use shortcodes combined with placeholders, placeholders on there aren't converted anymore since 5.3, only if within shortcode.

    Here's a snippet to enable placeholders on your descriptions if needed (note that using ph's in shorcode may not work properly with this)

    /**
     * Parses the event description to convert placeholders
     * @param string $result
     * @param EM_Event $EM_Event
     * @param string $placeholder
     * @param string $target
     * @return string
     */
    function my_em_event_output_placeholder($result,$EM_Event,$placeholder,$target='html'){
    	if( in_array($placeholder, array('#_EVENTNOTES','#_NOTES','#_DESCRIPTION','#_LOCATIONNOTES','#_CATEGORYNOTES')) ){
    		$result = $EM_Event->output($result);
    	}
    	return $result;
    }
    add_filter('em_event_output_placeholder','my_em_event_output_placeholder',10,4);
  4. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    paste this into your themes functions.php file

  5. Stewart Barklem
    Member
    Posted 1 year ago #

    Thanks for this, very helpful I now understand this. It’s good that my own shortcodes work in events.
    As I don’t need to do this very often I have decided to get round this by just putting the placeholders in a shortcode. So I have used ..
    [locations_list]ID=#_LOCATIONID Name=#_LOCATIONLINK[/locations_list]
    .. to find out the locationID and then used something like …
    [location location=4]#_LOCATIONMAP[/location]

  6. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    better yet, I'm going to add in the upcoming update an option to just use

    [location] or [event] within a location/event description and it'll default to the current location/event if you don't supply an ID number.

  7. Stewart Barklem
    Member
    Posted 1 year ago #

    Excellent!

  8. Stewart Barklem
    Member
    Posted 1 year ago #

    Still a slight niggle with this. In the list view the placeholders are interpreted correctly but the [event]… [/event] tags are still there!

  9. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    will look into that. in the meantime you could try adding this line:

    add_filter('dbem_notes', 'do_shortcode');

    not ideal but may do what you need for now.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic