Events Manager
[resolved] how to conditionally add an image to events in a list (3 posts)

  1. TheHappening604
    Posted 2 years ago #


    I am trying to add a "hot" icon next to the #_EVENTLINK in the events list based on if that event has 4 or more 'votes' which I get from another plugin.

    the voting mechanism is on the single event page

    I rewrote some functions in the voting plugin to display a hot icon
    with the shortcode "[hotornot]"

    my problem is that event lists do not accept shortcode am I going about this the wrong way or is there a way to include this into the events list format?

    this is what I have on my template page.

    echo EM_Events::output(array('format'=>
    <div id="list2">
    <ul></br>    <HR>
    <div style="float:left" margin-right:10px;"> #_CONTACTAVATAR</div>
        <div style="float:left"; margin-left:-15px;"><em>#_EVENTLINK </em></div>
    <a href="#_EVENTURL">
    <?php do_shortcode( "[hotornot]" ) ; ?>
        <div style="margin-left:-15px;">
    <li> <p>   <em> #_LOCATIONLINK </em> #_LOCATIONTOWN  </p></li>
    <p><fb:like send="true" layout="button_count" width="150" show_faces="false" href="#_EVENTURL" ></fb:like>
     <a href="https://twitter.com/share">Tweet</a>
    	', 'limit'=>6, 'pagination'=>1,'scope'=>'month', 'orderby'=>'event_start_date'));

    This is my voting short code (which works on a single event page)

         function hot_or_not_shortcode($atts){
           global $post;
           return hot_or_not_display($post->ID);
       add_shortcode('hotornot', 'hot_or_not_shortcode');


  2. agelonwl
    Posted 2 years ago #

  3. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    It's because you're not running that shortcode in a loop

    try wrapping the whole EM_Events output in do_shortcode() and use placeholder #_EVENTPOSTID to output the post id as an attribute in the shortcode, so it's parsed afterwards.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic