Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 4 replies, has 2 voices.

Last updated by robertoM-8 6 months ago.

Assigned support staff: Andreas W..

Author Posts
February 13, 2020 at 12:23 pm #5485841


I have a multisite
and subsites:

Link to a page where the issue can be seen:

I created a template on the main website.
in the functions.php there is a shortcode such as

function dds_global_partners_widget()
    global $switched;
    $output = do_shortcode('[elementor-template id="31450"]');
        return $output;
add_shortcode('dds_global_partners_widget', 'dds_global_partners_widget');

This way all the websites can import the widget by using a shortcode, and use it in Elementor in every website.

In all the websites where there is only one language, it works perfectly

In the websites where there are two languages or more, this happens

[13-Feb-2020 11:57:16 UTC] PHP Notice:  Undefined property: WP_Error::$taxonomy in /home/srvrfrm1/public_html/ on line 226
[13-Feb-2020 11:57:16 UTC] PHP Notice:  Trying to get property 'ID' of non-object in /home/srvrfrm1/public_html/ on line 31
[13-Feb-2020 11:57:16 UTC] PHP Fatal error:  Uncaught InvalidArgumentException: Argument ID must be numeric and greater than 0. in /home/srvrfrm1/public_html/
Stack trace:
#0 /home/srvrfrm1/public_html/ WPML_Translation_Element->__construct(NULL, Object(SitePress), NULL)
#1 /home/srvrfrm1/public_html/ WPML_Translation_Element_Factory->create_post(NULL)
#2 /home/srvrfrm1/public_html/ WPML_Elementor_URLs->adjust_edit_with_elementor_url('<em><u>hidden link</u></em>...', Object(ElementorPro\Modules\ThemeBuilder\Documents\Section))
#3 /home/srvrfrm1/public_html/ WP_Hoo in /home/srvrfrm1/public_html/ on line 28
February 13, 2020 at 11:06 pm #5490439

Andreas W.

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)


Thank you for contacting the WPML Support Forum.

The method you are using to implement the template might work well for the default language, but with WPML such Elementor templates will need to be translate din order to be used on translated pages and this will result in a different shortcode ID.

A solution would be to translate the templates and use their shortcodes in an "elseif" statement while referring to the matching ICL_LANGUAGE_CODE

An example:

More information can be found in our hook reference.

Kind regards

February 14, 2020 at 8:23 am #5492497


In the Main website WPML is not active.

Therefore i cannot create a translatable widget.
Also, the widget should not be translated since theres only images.

Can i force somehow the subsite (which has multiple languages) to load only the "one" widget from the main site (which has only one language)??

Plus, as you can see the widget is correctly loaded. But the page shows strangely (it's small than the viewport)
hidden link


February 14, 2020 at 9:16 am #5493031


I went on the Main Website (where the Widget is), went in WPML Options, and made the elementor templates NOT TRANSLATABLE.

This fixed my issue

February 14, 2020 at 9:16 am #5493123


My issue is resolved now. Thank you!