Home › Forums › Themes Support › Circle › Translated footer but its gone
- This topic has 4 replies, 2 voices, and was last updated 1 year, 5 months ago by
admin.
-
AuthorPosts
-
December 1, 2020 at 12:36 am #7922
Hi. I translated the footer block with WPML but it is not showing in the translated language. No footer instead. Am i doing something wrong?
December 1, 2020 at 12:46 am #7925This reply has been marked as private.December 1, 2020 at 1:53 am #7931Hi,
About your question we can answer as below:
1. Your admin site still can’t login. If your server blocked somethings please check it.
2. You can use Free plugin Polylang with tutorial here:
3. If you use WPML you You need customize code in 2 files: (xxx is name of theme)
wp-content/themes/xxx/templates/footer/footer.php
wp-content/themes/xxx/templates/footer/footer-stylesheet.phpThe new code in footer.php
$footer_id = get_post_meta( get_the_ID(), 'haru_'.'footer', true ); if ( $footer_id == '' ) { $footer_id = haru_get_option('haru_footer'); } $footer_translate_id = apply_filters( 'wpml_object_id', $footer_id, 'haru_footer' ); $content_post = get_post($footer_translate_id); $content = $content_post->post_content; $content = apply_filters( 'the_content', $content ); $content = str_replace( ']]>', ']]>', $content ); $footer_layout = get_post_meta( get_the_ID(), 'haru_'.'footer_layout', true ); if ( ($footer_layout == '') || ($footer_layout == '-1') ) { $footer_layout = haru_get_option('footer_layout'); } if ( $footer_layout != 'full' ) : ?> <div class="<?php echo esc_attr($footer_layout); ?> clearfix"> <?php endif; ?> <?php echo $content; ?> <?php if ( $footer_layout != 'full' ) : ?> </div> <?php endif; ?>
The new code in footer-stylesheet.php
if ( post_type_exists('haru_footer') && get_posts('post_type=haru_footer') ) { // Use this only when have footer post type $footer_id = get_post_meta( get_the_ID(), 'haru_' . 'footer', true ); if ( $footer_id == '' ) { $footer_id = haru_get_option('haru_footer'); } $footer_translate_id = apply_filters( 'wpml_object_id', $footer_id, 'haru_footer' ); $content_post = get_post($footer_translate_id); $content = $content_post->post_content; if ( $footer_translate_id && (get_the_ID() !== $footer_translate_id) ) { $shortcodes_custom_css = get_post_meta( $footer_translate_id, '_wpb_shortcodes_custom_css', true ); if ( !empty( $shortcodes_custom_css ) ) { $shortcodes_custom_css = strip_tags( $shortcodes_custom_css ); echo '<style type="text/css" data-type="vc_shortcodes-custom-css">'; echo wp_kses_post( $shortcodes_custom_css ); echo '</style>'; } } }
Reference here:
https://wpml.org/forums/topic/get-translated-post-id/
Hope this helps!****
Regards,
HaruTheme-
This reply was modified 1 year, 5 months ago by
admin.
December 2, 2020 at 4:42 pm #7944Hi, thanks for suggestion but i get “Call to undefined function pll_current_language() ” error .
FYI, link https://latvijasfilma.lv/ should work, i think there is issue with htaccess www and HTTP version of website.
December 3, 2020 at 12:41 am #7946We removed the line caused the error.
You can check the code above again.
In this case please remove all block in your server, then we can easy help you check the issues.****
Regards,
HaruTheme -
This reply was modified 1 year, 5 months ago by
-
AuthorPosts
You must be logged in to reply to this topic.