Changing static text in a theme into variable content that also respects language. Easiest way


I bought a Theme which unfortunately has some static content, I managed to hide and remove some via editing and the custom css.

But I have a text field above the navigation where it says “Work Time” I need a way to write the German and English version of that text somewhere in my WP-Admin panel and tell the theme to load selected language text into that text field.

I have coded some stuff in php js and mysql so I’m not new to coding but I don’t know anything about coding for/in WordPress. I need a quick solution. What would be the best way to go about it?

I thought maybe use widgets and their content since with the Polylang Plug-in I can set widget content to specific languages.

So i basically need to place a language check there and load the according string.

Would that be the quickest way? Can anybody point me to a solution?

here’s the part of the header .php I’m talking about

<ul class="bar">
<li class="address"><?php echo esc_html__('Work Time', 'doors') ?></li>
<li class="text_add"><?php
    $work_time = doors_get_option('work');
    if (empty($work_time)) {
        echo esc_html('');
    } else {
        echo esc_html(doors_get_option('work'));

Thank you in advance!

Ozzy 8 months 2022-05-24T15:56:04-05:00 0 Answers 0 views 0

Leave an answer