Show Event Date rather than creation date

Posted in: Newsmag
Post count: 59

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

Post count: 6600

Hi,

Try adding it like this: http://screencast.com/t/7ujIapbcLX

Thanks

Post count: 59

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) . '"/>';
}

Post count: 6600

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.
Viewing 4 posts - 1 through 4 (of 4 total)
The forum ‘Newsmag’ is closed to new topics and replies.