• Resolved Najm

    (@gcsaudi)


    Hi there,

    Am using WPML and was wondering if there is any possible way to translate the field TOC title, so that it show the correct translation on each language.

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author WPJoli

    (@wpjoli)

    Hi,

    Because the title is a user setting, it’s a dynamic string and cannot directly be picked up by WPML.

    One way to achieve this would be to add a filter hook to the title, which you could then change depending on the language with a few lines of code.

    In the current version, there is no such filter for the title, but I’m taking your suggestion into account for the next update ??

    Cheers!

    Thread Starter Najm

    (@gcsaudi)

    Great!

    Thanks, and i cant wait for that update to come soon.

    Plugin Author WPJoli

    (@wpjoli)

    Hi,

    You can now customize title before output as of 1.3.8. You need to add some line of codes to your theme’s functions.php like this example (you need to adapt it to your needs):

    add_filter('joli_toc_toc_title', 'my_custom_title', 10, 1);
    
    function my_custom_title( $title ){ 
        //custom condition
        if ($a == $b){
            $title = "My Custom TOC Title";
        }else{
            $title = "My Alternate TOC Title";
        }
    
        return $title;
    }
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Translate “TOC title”’ is closed to new replies.