• Resolved dados

    (@dados)


    Hi,

    I have a issues to Synchronize Theme options field with String Translation. I use wpml-config.xml and field in Theme options

    In Theme option I have field
    <input type="text" value="Call to action Title" id="theme_cta_title" name="theme_cta_title">

    My config file look like this:

    <wpml-config>
        <admin-texts>
            <key name="theme_cta_title" />
        </admin-texts>
    </wpml-config>

    and in page.php I have this ( I think this is correct? )

    <?php
    $theme_cta_title = get_option('theme_cta_title');
    pll_e($theme_cta_title);
    ?>

    And now, I open my Theme options page, write new string “Test Title” and its show up in String Translation, but problem is when I change it on “String Translation” tab page https://prntscr.com/9s2dql for example I write instead “Test Title” now is “Test Title String tab”, and text in filed on Theme Options page is not changed, is still “Test Title”

    https://www.ads-software.com/plugins/polylang/

Viewing 14 replies - 1 through 14 (of 14 total)
  • Plugin Support Chrystl

    (@chrystl)

    Hi
    If you use a wpml-config.xml you don’t need to use the Polylang function such as pll_e.

    In your wpml-config.xml file you must have the name of the theme option:

    <wpml-config>
        <admin-texts>
            <key name="my_theme_options">
               <key name="option_name_1" />
             </key>
        </admin-texts>
    </wpml-config>
    Thread Starter dados

    (@dados)

    1.) If you use a wpml-config.xml you don’t need to use the Polylang function such as pll_e.
    – But how then I can echo string on page.php .. this CTA title need to be echo in H1 tag, from theme options, you mean to just echo like this

    <?php
    $theme_cta_title = get_option('theme_cta_title');
    echo $theme_cta_title;
    ?>

    2.) In your wpml-config.xml file you must have the name of the theme option:
    – hmmm… I have this, can you please help me on xml file?

    $themename = "My Theme";
    $shortname = "theme";
    $options = array (
    array( "name" => $themename." Options",
           "type" => "title"),
    array("name" => "CTA TITLE",
          "id" => $shortname."_cta_title",
          "type" => "text",
          "std" => 'Call to action Title'),
    Thread Starter dados

    (@dados)

    found in database this.. maybe can help https://prntscr.com/9sb1q9

    Plugin Support Chrystl

    (@chrystl)

    You can unserialize the option_value of the theme_mods_ahmz to see if it’s the right option.

    Thread Starter dados

    (@dados)

    hmm when I paste option_value of the theme_mods_ahmz I get this , Is it possible that I do not have <key name=”my_theme_options”>

    (
        [0] =>
        [nav_menu_locations] => Array
            (
                [primary-menu] => 9
                [secondary-menu] => 10
            )
    
    )
    Plugin Support Chrystl

    (@chrystl)

    It seems that it’s not the right option. Which theme do you use? Is it freely available?

    Thread Starter dados

    (@dados)

    Its custom code theme ?? … Is it possible that I do not have <key name=”my_theme_options”> .. or how I can add it

    Plugin Support Chrystl

    (@chrystl)

    In your DB (PhpMyAdmin), go in wp_options, then in the search form. For the raw option_value you must select LIKE %..% (Operator column), and add Test Title (Value column).
    Which result have you?

    Thread Starter dados

    (@dados)

    this is I get https://prntscr.com/9sjiri and when I open to edit https://prntscr.com/9sjiwz

    Thread Starter dados

    (@dados)

    just to explain I change this $shortname = “theme”; to $shortname = “swt”; so now instead theme_cta_title I have swt_cta_title

    Plugin Support Chrystl

    (@chrystl)

    I see you use only a simple option. Your wpml-config.xml is correct. Sorry I was a bit long to understand.

    but problem is when I change it on “String Translation” tab page https://prntscr.com/9s2dql for example I write instead “Test Title” now is “Test Title String tab”, and text in filed on Theme Options page is not changed, is still “Test Title”

    Could you provide some screenshots to illustrate that?

    Thread Starter dados

    (@dados)

    okay.. here it is..

    I wrote “Title test” in theme option https://prntscr.com/9skgve and then its show up here https://prntscr.com/9skh7y .. but when I change it https://prntscr.com/9skhkk Theme options string not updated https://prntscr.com/9skhsa .. Instead “Title test sssss” I still have “Title test” .. on fronted its work okay, title is changed.

    But I’m afraid when client want to change something in theme option, what will happen if click on save “Theme Option” because old string is remained..

    Plugin Support Chrystl

    (@chrystl)

    Instead “Title test sssss” I still have “Title test” ..

    It’s the normal behavior. The strings that you fill in the Strings translation table don’t override the Theme options. You have a change only on the front.

    Thread Starter dados

    (@dados)

    Ohh.. Okay.. Something I have now realized .. when I save theme options, on fronted its showing new string from translate field https://prntscr.com/9skhkk .. So its okay ?? .. this work.. ohhh how much posts and actually this works ?? I thought field in theme options also should be updated ?? .. sorry for all time you lost on me

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Synchronize Theme options with String Translation’ is closed to new replies.