• Resolved castiblanco

    (@castiblanco)


    Hello, I want to be able to translate a single string which is placed in the Page Header of a page using WPBakery Page Builder with the theme Future Architecture.

    https://162.241.239.69/~dibatica/portfolio/

    I have installed both WPGlobus and WPGlobus for WPBakery Visual Composer, but it just let me translate the page, there it not option for the header.

    Is there anyway I can translate a single string, in this case Portfolio which is the red hexagon.

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

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Contributor Alex Gor

    (@alexgff)

    If you have multilingual string with language marks
    then you can use this piece of code to get string in current language

    
    echo apply_filters('the_content', '{:es}Es text{:}{:fr}Fr text{:}');
    
    Thread Starter castiblanco

    (@castiblanco)

    Thanks Alex, don’t really get it.

    When you said “multilingual string with language marks” is the way to write the portfolio title? If I write {:es}Portafolio{:}{:fr}Portfolio on Fr{:} it is showed like that on both languages ({:es}Portafolio{:}{:fr}Portfolioon Fr{:}).

    Where I should include the filter?

    I used the filter in the function file and use {:es}Portafolio{:}{:fr}Portfolio on Fr{:} on my page header tittle but it doesn’t work, what happen when I include that on functions is that I guess a message at the beginning of the page “Es text”.

    Thanks for you help.

    Plugin Contributor Alex Gor

    (@alexgff)

    you should insert
    echo apply_filters(‘the_content’, ‘{:es}Es text{:}{:fr}Fr text{:}’);
    into file header.php of your theme.

    Thread Starter castiblanco

    (@castiblanco)

    Look how my header.php looks like:

    	<?php wp_head(); ?>
    	<?php echo apply_filters('the_content', '{:es}Es text{:}{:fr}Fr text{:}'); ?>
    </head>

    And when I load https://162.241.239.69/~dibatica/portfolio/ it shows Es text on top to the page instead of changing the string.

    Plugin Contributor Alex Gor

    (@alexgff)

    If you switch to French then you’ll get correct string ‘Fr text’.
    Next step is to find correct place in your template to insert filter for your need.

    Thread Starter castiblanco

    (@castiblanco)

    So, what I have to do it to look into the theme files, the header thing was just for testing is guess then… Look, I found in templates/template-page-header.php the div that is showing the title.

    echo '<div id="page-header-title">';
    	echo $ewf_modHeader_meta['title']; 
    echo '</div>';

    How should I include: echo apply_filters(‘the_content’, ‘{:es}Es text{:}{:fr}Fr text{:}’); to that code?

    Plugin Contributor Alex Gor

    (@alexgff)

    
    echo '<div id="page-header-title">';
            echo apply_filters('the_content', $ewf_modHeader_meta['title']); ?>
    echo '</div>';
    
    Thread Starter castiblanco

    (@castiblanco)

    Thank you so much, it did the trick! ??

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Translare “Page Header” using WPBakery Page Builder’ is closed to new replies.