Hi there,
in Newspaper theme I got this code from Marius to display the event date from my Events Plugin rather than the date of post creation.
if ( 'event' == get_post_type($this->post->ID) ) {
$EM_Event = em_get_event($this->post->ID, 'post_id');
$buffy .= '<time itemprop="dateCreated" class="entry-date updated' . $visibility_class . '" datetime="' . date(DATE_W3C, $td_article_date_unix) . '" >' . $EM_Event->output('#_EVENTDATES') . '</time>';
$buffy .= '<meta itemprop="interactionCount" content="UserComments:' . get_comments_number($this->post->ID) . '"/>';
} else {
$buffy .= '<time itemprop="dateCreated" class="entry-date updated' . $visibility_class . '" datetime="' . date(DATE_W3C, $td_article_date_unix) . '" >' . get_the_time(get_option('date_format'), $this->post->ID) . '</time>';
$buffy .= '<meta itemprop="interactionCount" content="UserComments:' . get_comments_number($this->post->ID) . '"/>';
}
to put in td_module.php to replace: http://screencast.com/t/TM3Sx1AKK
In Newsmag there is a slight change. Could you please assist me to convert this code to Newsmag?
Cheers
Hi Lucian,
I would like to use your code from above to insert next to the event date “. $EM_Event->output(‘#_EVENTDATES’)” the event location #_LOCATIONTOWN in block if post is an event (if ( ‘event’ == get_post_type($this->post->ID) ).
Could you please give me any advice where to put it? Thanks very much!
if ( 'event' == get_post_type($this->post->ID) ) {
$EM_Event = em_get_event($this->post->ID, 'post_id');
$buffy .= '<time itemprop="dateCreated" class="entry-date updated' . $visibility_class . '" datetime="' . date(DATE_W3C, $td_article_date_unix) . '" >' . $EM_Event->output('#_EVENTDATES') . '</time>';
$buffy .= '<meta itemprop="interactionCount" content="UserComments:' . get_comments_number($this->post->ID) . '"/>';
} else {
$buffy .= '<time itemprop="dateCreated" class="entry-date updated' . $visibility_class . '" datetime="' . date(DATE_W3C, $td_article_date_unix) . '" >' . get_the_time(get_option('date_format'), $this->post->ID) . '</time>';
$buffy .= '<meta itemprop="interactionCount" content="UserComments:' . get_comments_number($this->post->ID) . '"/>';
}
Hi,
You could try to add it like this: http://screencast.com/t/VL3jCZ3utgvg
Add this line like shown:
$buffy .= '<span class="location_class" >' . $EM_Event->output('#_LOCATIONTOWN') . '</span>';
You would probably need to style it to look well on front end, use css and target the location_class set fro the span tag.
Thanks
-
This reply was modified 11 years by
Lucian.