Forums › Forums › Search & Filter Pro › Integration of Events Manager formats
Tagged: Events Manager
- This topic has 9 replies, 2 voices, and was last updated 6 years, 3 months ago by Anonymous.
-
Anonymous(Private) July 30, 2018 at 8:19 am #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(Private) July 30, 2018 at 9:54 am #183843I 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 />
Anonymous(Private) July 30, 2018 at 10:50 am #183860I 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(Private) July 30, 2018 at 11:12 am #183864It 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.
Anonymous(Private) July 30, 2018 at 11:43 am #183876Thanks 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!
-
AuthorPosts