Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #923972

    I’ve build many RTL WordPress site with Enfold because it’s by far the best theme I know
    not too long ago Enfold’s amazing support helped me improving enfold’s RTL compatibility on the admin side with this simple code snippet (https://kriesi.at/support/topic/reverse-columns-order-on-rtl-site/#post-889453) and it’s great!
    here is the code

    add_action('admin_head', 'rtl_columns_fix_css');
    function rtl_columns_fix_css() {
    	$output = "<style>.avia_layout_column, .avia_layout_section, .avia-highlight { float: right !important; }</style>";
    	echo $output;
    }

    and it works wonderfully on RTL sites
    BUT on multilingual sites i’m building (with the WPML plugin) it becomes problematic because it affects all pages in the admin side, even pages set by the plugin to English (or any other LTR languages)
    so my only question is: is there a way, on multilingual sites, to use this code but to limit it so it will effect only admin editing screens of RTL language pages and not all the edit screens?

    thanks in advance
    Doron

    • This topic was modified 6 years, 9 months ago by Doron. Reason: typo
    #924735

    Hey Doron,

    Please add

    
    add_action('admin_head', 'rtl_columns_fix_css');
    function rtl_columns_fix_css() {
    if ( is_rtl() ) {
    	$output = "<style>.avia_layout_column, .avia_layout_section, .avia-highlight { float: right !important; }</style>";
    	echo $output;
    }
    }
    

    so that code can go ahead only on RTL! ;-)

    Best regards,
    Basilis

    #925092

    Hi Basilis
    I’m afraid It’s not working
    even with your new code still the layout (in the editing screen on the admin side) of English pages is flipped (and not just the Arabic or Hebrew which are RTL)

    may be the detection (of whether the edit screen is for RTL or LTR content) should be done by detecting WPML’s language settings for that editing page?
    lets say, only if the values “he” or “ar” or “fa” is defined as “selected” in the “icl_post_language” than the code should work
    but I don’t know how to write that kind of “if” in PHP syntax
    could it be done?

    #926124

    UPDATE:
    solved!
    i consulted WPML support and they gave me the following ‘if’ code which seems to work perfectly:

    if( is_rtl() && in_array( ICL_LANGUAGE_CODE, array( "he", "ar", "fa" ) ) ) {
        // rtl code
    }

    so you can close this thread
    and again thank you very much for all the help
    :)

    #926385

    Hi,

    Thank you for the info. We’ll forward this to our developers.

    Best regards,
    Ismael

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.