Tagged: 

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1198791

    Hey, I want to build a website that has a hebrew version (in addition to the english version) is there a possibility to make specific pages on the website in RTL mode while the others are LTR?

    Thanks

    • This topic was modified 4 years, 8 months ago by kfir_menashe.
    #1198950

    Hey kfir_menashe,
    To enable the RTL only on some pages on your site please add this code to the end of your functions.php file in Appearance > Editor:

     function enqueue_rtl() {
    	if ( is_page( array( 597, 'features', 'meet-the-team' ) )  ) {
    	wp_enqueue_style(  'avia-rtl',  get_template_directory_uri()."/css/rtl.css", array(), '1', 'screen' );
    	}
      }
      add_action( 'wp_enqueue_scripts', 'enqueue_rtl', 100 );

    you can change the pages it changes to RTL in the “array” in the code above, just add “Page IDs” or “Page Titles” or “Page Slugs”

    Best regards,
    Mike

    #1200667

    Thanks for the answer Mike but it does not seem to work.
    I added the code to the functions.php and added a page to check but I see no change.
    Since Im not really that femiliar with html can you please write an example of how you would enter a page to the array using the page slug ?

    thanks

    #1200782

    Hi,
    The code above is a working example with the slug “meet-the-team”, Please include an admin login in the Private Content area and the test page you wish to use.
    Perhaps you are missing a bracket from the code.

    Best regards,
    Mike

    #1202198

    It works, Thanks
    is there a way to do the same for posts and portfolio items?

    #1202656

    Hi,
    Glad to hear that it is working for you, instead of using if ( is_page ) you could use if ( is_singular ) is_singular() is for existing single post of any post type (post, attachment, page, custom post types including portfolio items).
    Please explain if you want to define when this is active or when it is not active. Do you want the RTL on most pages & posts or just a few?

    Best regards,
    Mike

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