• hamish1969

    (@hamish1969)


    Hi there!

    I’ve been using the Events Manager for a few months now and I’m still thrilled with it! However, I would like to customize the plugin a bit. I want to create events that are displayed in the calendar and event lists (with date and everything) but do not have a details page. In other words, they should not be clickable.

    I have now created a custom placeholder “EventDetails”, with which one i can select “Yes” or “No”. With “#_ATT{EventDetails}”, I can also display “Yes” or “No” on the detail pages as well as in the event lists. However, I can’t process the values further in PHP. I tried it this way:

    $hasDetails = do_shortcode("#_ATT{EventDetails}"); 
    
    if($hasDetails == "Yes") 
    { 
    echo "#_EVENTLINK"; 
    } else { 
    echo "_EVENTNAME"; 
    }
    
    

    Unfortunately, that doesn’t work. The interresting thing is that “echo $hasDetails; gives out the expected “Yes” or “No” but “var_dump($hasDetails)” gives out a string(19) and i dont know why.

    However, when I try to access the content of the field using “get_post_meta()”, it only works on the Event Page because I can get the Post-ID with get_the_ID(). But this doesn’t work on the page that displays the event list because i can’t get the right Event-ID. The ID of the page who is schowing the event list is always used. (Maybe php doesn’t recognize that its in the has_posts() loop.)

    i got pretty stuck in this. Does anyone have an idea how I can achieve my goal, or am I overlooking something?

    Thank you all and greets from Germany!

    • This topic was modified 12 months ago by hamish1969.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • joneiseman

    (@joneiseman)

    You can use the following in the event list:

    global $EM_Event;
    $hasDetails = get_post_meta($EM_Event->post_id, "EventDetails", true);
    if($hasDetails == "Yes") 
    { 
        echo "#_EVENTLINK"; 
    } else { 
        echo "#_EVENTNAME"; 
    }
    Thread Starter hamish1969

    (@hamish1969)

    Thanks for your reply!

    I already tried this but because of your reply, i tried it another time with the same result. I get an error message that i try to get an ID of a null object. global $EM_Event is null if i print it with var_dump(). This is my code in the event_list_item_format.php:

    ...
    ...	
    <div class="em-item-info">
    
          <?php
    	  global $EM_Event;
              $hasDetails = get_post_meta($EM_Event->post_id, "EventDetails", true);
    
    	  if($hasDetails == "Yes") 
              { 
    		echo "#_EVENTLINK"; 
    		} else { 
    		echo "#_EVENTNAME"; 
    	  }
           ?>
    
    ...
    ...
    • This reply was modified 12 months ago by hamish1969.
    • This reply was modified 12 months ago by hamish1969.
    joneiseman

    (@joneiseman)

    You could create a custom conditional placeholder to handle this: https://www.ads-software.com/support/topic/conditional-placeholders-for-custom-event-attributes/

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Events without detail page – non clickable’ is closed to new replies.