Support Forums

The forums are closed and will be removed when we launch our new site.

Looking for support? You can access the support system via your account.

Forums Forums Search & Filter Pro Integration of Events Manager formats

Viewing 10 posts - 1 through 10 (of 10 total)
  • Jean Pietrowicz
    #183830

    Hi, I would like to output the formats I have defined in Events Manager for the event dates, times and teaser text to the Search & Filter Pro results page. Using the_excerpt() function strips away the formatting.

    I’ve asked Events Manager Support and they said to use this code to get the EM formats:
    $post = get_the_post(); //or however you do it
    $EM_Event = em_get_event($post);
    echo $EM_Event->output(‘output your html with placeholders’);

    However, I could not integrate this into your results.php page without throwing an error, or disabling the live search functionality.

    Do you have any suggestions? I’ve tried the_content() but that outputs my entire events detail page, which I don’t want on the search page.

    Many thanks in advance.

    Trevor Moderator
    #183833

    Are you using our Shortcode Display Results method?

    Trevor Moderator
    #183835

    I would guess the first two lines would be a single line instead:

    $EM_Event = em_get_event(get_the_ID());
    
    Jean Pietrowicz
    #183841

    Could you tell me where to insert this in results.php, so that it will still work?
    Thanks!
    Yes, I am using the shortcode display method.

    Trevor Moderator
    #183843

    I am not familiar with the coding of Events Manager. I do not know what they mean by the next line that they gave you:

    echo $EM_Event->output('output your html with placeholders');
    

    The text string output your html with placeholders is obviously meant to be changed, but to what I do not know.

    Potentially you are looking replace all of this code in our template:

    <div>
      <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    
      <p><br /><?php the_excerpt(); ?></p>
      <?php 
        if ( has_post_thumbnail() ) {
          echo '<p>';
          the_post_thumbnail("small");
          echo '</p>';
        }
      ?>
      <p><?php the_category(); ?></p>
      <p><?php the_tags(); ?></p>
      <p><small><?php the_date(); ?></small></p>
    
    </div>
    
    <hr />
    Jean Pietrowicz
    #183856
    This reply has been marked as private.
    Trevor Moderator
    #183858

    Ah, the code needs to be inside php tags then, like this

    <?php
    $EM_Event = em_get_event(get_the_ID());
    echo $EM_Event->output('output your html with placeholders');
    ?>
    Jean Pietrowicz
    #183860

    I appreciate your help with this. This is how my code looks now:

    <?php
    	while ($query->have_posts())
    	{
    		$query->the_post();
    		
    		?>
    	<php
    		$EM_Event = em_get_event(get_the_ID());
    echo $EM_Event->output('<div class="event-listing">
    <div class="event-thumbnail-wrap">
    <a href="#_EVENTURL">
     <div class="event-thumbnail" style="background-image: url('#_EVENTIMAGEURL');">
    </div>
    </a>
    </div>
    			<div class="event-text">
                   <span class="eventdates">#_EVENTDATES</span><br/>
                   <span class="eventtimes"><em>#_EVENTTIMES Uhr</em></span><br/>
                    <span class="eventlink">#_EVENTLINK</span><br/>
    <p>#_EVENTEXCERPT</p>
       {has_location}<br/><i>#_LOCATIONNAME, #_LOCATIONTOWN #_LOCATIONSTATE</i>{/has_location}
    
               </div>
    </div>');
    ?>
    	
    		<?php
    	}
    	?>

    But if you look at the URL I sent previously, there is still a problem.

    Trevor Moderator
    #183864

    It should look more like this:

    <?php
    	while ($query->have_posts())
    	{
    		$query->the_post();
    		
    		$EM_Event = em_get_event(get_the_ID());
    echo $EM_Event->output('<div class="event-listing">
    <div class="event-thumbnail-wrap">
    <a href="#_EVENTURL">
     <div class="event-thumbnail" style="background-image: url('#_EVENTIMAGEURL');">
    </div>
    </a>
    </div>
    			<div class="event-text">
                   <span class="eventdates">#_EVENTDATES</span><br/>
                   <span class="eventtimes"><em>#_EVENTTIMES Uhr</em></span><br/>
                    <span class="eventlink">#_EVENTLINK</span><br/>
    <p>#_EVENTEXCERPT</p>
       {has_location}<br/><i>#_LOCATIONNAME, #_LOCATIONTOWN #_LOCATIONSTATE</i>{/has_location}
    
               </div>
    </div>');
    	}
    ?>

    BUT, the part in the output brackets may be problematic and it has single quotes around double quotes with single quotes inside. You may need to show that to the Events Manager support.

    Jean Pietrowicz
    #183876

    Thanks for your tip. With Events Manager Support’s help, we’ve escaped the quotes around the background image and now it works:

    <?php
    	while ($query->have_posts())
    	{
    		$query->the_post();
    		
    		$EM_Event = em_get_event(get_the_ID());
    echo $EM_Event->output('<div class="event-listing">
    <div class="event-thumbnail-wrap">
    <a href="#_EVENTURL">
     <div class="event-thumbnail" style="background-image: url(\'#_EVENTIMAGEURL\');">
    </div>
    </a>
    </div>
    			<div class="event-text">
                   <span class="eventdates">#_EVENTDATES</span><br/>
                   <span class="eventtimes"><em>#_EVENTTIMES Uhr</em></span><br/>
                    <span class="eventlink">#_EVENTLINK</span><br/>
    <p>#_EVENTEXCERPT</p>
       {has_location}<br/><i>#_LOCATIONNAME, #_LOCATIONTOWN #_LOCATIONSTATE</i>{/has_location}
    
               </div>
    </div>');
    	}
    ?>

    Thanks again for your help in solving this problem!

Viewing 10 posts - 1 through 10 (of 10 total)

The topic ‘Integration of Events Manager formats’ is closed to new replies.