Hi,
I get this too using default twentytwelve theme however it’s more likely a theme issue rather than EM; maybe something to do with custom post types (since EM uses CPT) and a template file missing a translation?
also, maybe you can try this link (creating single-event.php within your theme) – http://ww.wp.xz.cn/support/topic/events-manager-eventslocation-pages-cant-get-sidebar?replies=21 or copy your theme single.php then rename it to single-event.php and add this snippet
<?php echo date_i18n(get_option('date_format') ,strtotime(get_the_date()));?>
Hi there,
thanks. Before I try your suggestions what does this snippet
<?php echo date_i18n(get_option('date_format') ,strtotime(get_the_date()));?>
actually do?
Cheers
date_i18n – http://codex.ww.wp.xz.cn/Function_Reference/date_i18n
when I tried function get_the_date() it actually get the date but it’s not translated and this function date_i18n did it correctly.
Thanks,
much more important though is the empty category (posted in …)
Wouldn’t it be easier to get rid of the whole bar like in
if ( ! is_event() )
I mean show it for wp posts and get rid of it for events.
Do you have any ideas how to do that?
Cheers
this might be a theme issue also since it’s working fine using default theme twenty twelve.
Hi again,
I found the part which is responsible for this section:
<?php _e('Veröffentlicht am','swagger'); ?>
<?php echo get_the_date(); ?>
<?php _e('von','swagger'); ?>
<?php the_author_link(); ?>
<?php _e('in','swagger'); ?>
<?php // get parent category
if(get_post_type() == 'post') {
$category = get_the_category();
$cat_tree = get_category_parents($category[0]->term_id, FALSE, ':', TRUE);
$top_cat = split(':',$cat_tree);
$parentObj = get_category_by_slug($top_cat[0]);
$parent = $parentObj->name;
$cat_link = get_category_link($parentObj->term_id);
} else {
$parent = "";
$cat_link="";
}
?>
<?php if(!$parent=="") { ?>
<a href="<?php echo $cat_link; ?>"><?php echo $parent; ?></a>
<?php } ?>
I tried with is_event but no luck. Do I have to write a funcion first? Sorry but I am no php man. Above code needs to go when I display an event.
Any help would be appreciated. Cheers
Hi,
try to add to change
if(get_post_type() == 'post') {
to
if(get_post_type() == 'post' || get_post_type() == 'event' || get_post_type() == 'event-recurring' || get_post_type() == 'location') {
or this link might give you an idea – http://pastebin.com/uLEak8Q5
Hi agelonwl,
Thanks for helping.
Your snippet doesn’t work though:
Catchable fatal error: Object of class WP_Error could not be converted to string
Cheers
you can try this snippet
if(get_post_type() == 'event' || get_post_type() == 'event-recurring') {
global $post;
$EM_Event = em_get_event($post->ID, 'post_id');
$cat_name = $EM_Event->output('#_CATEGORYNAME');
$cat_link = '<a href="' . get_term_link( $cat_name, EM_TAXONOMY_CATEGORY ) . '">' . $cat_name . '</a>';
echo $cat_link;
}
btw, I tried this using template single-event.php – e.g. copy your theme single.php and rename it to single-event.php
Hi again,
my page is called single-normal.php and sits in folder “inc”.
Do I have to rename to single-normal-event.php? Or still to single-event.php?
Cheers
yes, you can try that however try to make another copy of your single-normal.php and then rename it to single-event.php; or another way is to ask your theme provider about supporting custom post type since EM is using CPT.
Hi there,
it works now in the way that it grabs the right category and the date is in German. The displayed date itself though is still the actual event date and not the post creation date as in normal wp posts.
Cheers