Translate post date?
-
Hi from Germany,
I was looking for an easy to use post carousel solution and stumbled over your nice plugin. Works like a charm so far. But as usual, I ran into an issue: I am unable to translate the date in the ig-posts-carousel shortcode.
I have a bit of php knowledge, so I handeled it this way (using wpml):
<?php if(ICL_LANGUAGE_CODE == 'en'){ $format = get_the_date('F j, Y'); } else if(ICL_LANGUAGE_CODE == 'es'){ $format = get_the_date('j F, Y'); } else if(ICL_LANGUAGE_CODE == 'de'){ $format = get_the_date('j. F Y'); } else { $format = get_the_date(); } ?>and then replace
<span class="date"><?php echo get_the_date(); ?></span>with<span class="date"><?php echo $format; ?></span>Works, but will be gone after your next update. Maybe you could incorporate a filter for that situation, like this:
<span class="date"><?php echo apply_filters('ig-posts-carousel-date',get_the_date()); ?></span>Others than that: Nice and easy, not as bloated as many other post carousels.
The topic ‘Translate post date?’ is closed to new replies.