Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter pebeh

    (@pebeh)

    Hi Chouby,

    again thanks for your fast reply. If I get it right I would only be able to access these strings defined in wpml-xonfig.xml via php and not via regular backend editing, right?

    I now tried to add my own shortcode to create the desired functionality, but it doesn’t seem to work. Could you have a look at it? I added the following code to my themes function.php:

    function translation_func( $atts ) {
        $a = shortcode_atts( array(
            'text' => 'defaulttext',
    	'multiline' => 'false'
        ), $atts );
    
        pll_register_string("Shortcode", $a['text'], "Shortcodes", (multiline == 'true'));
    
        return pll__($a['text']) . "AppendedText";
    }
    add_shortcode( 'translation', 'translation_func' );

    The shortcode itself seems to work as ‘[translation text=”test”]’ results in ‘testAppendedText’. Yet ‘test’ isn’t beeing registered and won’t show up in the string translations.

    Thanks again

    EDIT: If I use icl_register_string() it works perfectly.
    Anyway I now created exactly the functionality I wanted to have. Can you tell me if it has any drawbacks I’m currently unaware of? If not, maybe you want to implement this in a future release.
    `

    Thread Starter pebeh

    (@pebeh)

    Hi Chouby,

    thanks for your fast reply. You were right, the needed option wasn’t visible because my theme was setting it in the wpml-config file. However, I now removed the part of the xml file which was causing this and can now see the needed options. They are not ticked anymore and in the portfolio list I don’t see any translations anymore.

    Yet the new item I created afterwards doesn’t seem to be language independent. If I open it it is missing the language paramenter in the URL – but I still get redirected to the homepage if I select another language with the language switcher.

    Is this the intended behaviour?

    Thanks again

Viewing 2 replies - 1 through 2 (of 2 total)