Support » Plugin: Related Posts by Taxonomy » WPML – Translation

  • Thanks for the amazing plugin. I have been using it for a while. Works like a charm.

    I put the code that you mentioned in the documentation to my themes functions php and added the short code according to my needs. It works as it should work below every post. Now I am changing my site to bilingual website and using WPML plugin.

    My site is in Turkish and My shortcode is below:
    $shortcode = ‘[related_posts_by_tax posts_per_page=”4″ format=”lists” image_size=”medium” columns=”2″ related_posts_by_tax title=”BUNLAR DA İLGİNİZİ ÇEKEBİLİR”]’;

    But now I have also the English translations of the pages and in the English Pages “BUNLAR DA İLGİNİZİ ÇEKEBİLİR” should change to “RELATED POSTS” under each post.

    How can I do that?

    Thank you

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Author keesiemeijer

    (@keesiemeijer)

    Hi

    Try it with this in your (child) theme’s functions.php file

    
    add_filter( 'related_posts_by_taxonomy_shortcode_atts', 'rpbt_update_title_for_locale' );
    
    function rpbt_update_title_for_locale( $args ) {
    	$locale = get_locale();
    
    	$args['title'] = 'BUNLAR DA İLGİNİZİ ÇEKEBİLİR';
    
    	if ( ! $locale || ( 'en_US' === $locale ) ) {
    		$args['title'] = __( 'Related Posts', 'your-theme-domain' );
    	}
    
    	return $args;
    }
    

    btw:
    consider creating a child theme instead of editing your theme directly – if you upgrade the theme all your modifications will be lost. Or create a plugin with the code above.

    • This reply was modified 1 year, 4 months ago by  keesiemeijer.
Viewing 1 replies (of 1 total)
  • The topic ‘WPML – Translation’ is closed to new replies.