Using RoyalSlider post slide with multi-lingual site

moniquebolland's Avatar

moniquebolland

11 Oct, 2017 11:37 PM

Hi,
I have several sliders on my multi lingual (WPML) site. Most are Custom sliders so I can simply create separate versions for each language and embed the correct one in the page.
How do I manage Posts sliders on multi-lingual sites? If I create a slider displaying my 5 most recent posts, I need it to show the 5 most recent posts in the language the page is being viewed in. Currently it is just showing the most recently added content, regardless of language.
Am I missing something in the settings or are you able to help me please?
You can see an example here: http://wordpress-118418-337862.cloudwaysapps.com/blog/

  1. Support Staff 1 Posted by Dmitry Semenov on 12 Oct, 2017 05:27 AM

    Dmitry Semenov's Avatar

    Hello,

    For posts slider, you may either:

    Disable slider cache on its Settings page and it'll show different versions. It depends on your WPML settings though and might not always work, for example, taxonomy ids must be the same for each language though


    Create two separate sliders. One for each language (switch to a language that you need in admin -> and create slider ...). Then you may use PHP to include required shortcode based on the current language.


    The third way would be to use PHP filter that allows modifying slider posts query http://help.dimsemenov.com/kb/wordpress-royalslider-advanced/wp-mod...

    As stated on WPML forum, you can try adding uppress_filters=0 https://wpml.org/forums/topic/get_posts-by-language/ , for example:

    function newrs_modify_query_for_wpml($args, $index) {
        $args['uppress_filters'] = 0;
        return $args;
    }
    add_filter('new_royalslider_posts_slider_query_args', 'newrs_modify_query_for_wpml', 10, 2);
    
  2. 2 Posted by moniquebolland on 12 Oct, 2017 05:39 AM

    moniquebolland's Avatar

    Hi Dmirty,

    Thank you for the fast response.

    I want to create two separate sliders as you suggested but how to I make one ‘English’ and one ‘Czech’? They both show the most recently added posts in any language.

    Kind Regards,

    Monique Bolland

    t: 0421 486 865
    f: 02 9357 2095
    e: [email blocked] <mailto:[email blocked]>

  3. Support Staff 3 Posted by Dmitry Semenov on 12 Oct, 2017 12:54 PM

    Dmitry Semenov's Avatar

    Try add the filter via PHP that I posted in the previous message. (also save the slider to make sure it's not cached, and disable the cache itself by setting refresh time to 0 on RoyalSlider Settings page).

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac