Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Show linked WPML posts in a loog
- function wpml_post_languages_in_loop() {
- $post_trid = apply_filters('wpml_element_trid', NULL, get_the_ID(), 'post_' . get_post_type());
- $languages = apply_filters( 'wpml_active_languages', NULL, 'skip_missing=0&orderby=code' );
- if (empty($post_trid))
- return;
- $translation = apply_filters('wpml_get_element_translations', NULL, $post_trid, 'post_' . get_post_type());
- if (1 < count($translation)) {
- echo __('Document also available in: ');
- foreach ($translation as $l) {
- if ($l->element_id != get_the_ID()) {
- $langs[] = '<a href="' . apply_filters('wpml_permalink', ( get_permalink($l->element_id)), $l->language_code) . '">' . $languages[$l->language_code]['translated_name'] . '</a>';
- }
- }
- echo join(' ', $langs);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement