0

I want to make a child theme for twentyfifteen theme in WordPress to show in right-to-left direction. I read the documentation on that in Codex. But to be honest, the documentation was good for a general outline of the setup but not so clear on details and in case the theme already has an RTL support.

These were my steps:

created a child theme directory named twentyfifteen-ar

created a file functions.php inside the directory that only contains:

<?php
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
function my_theme_enqueue_styles() {
    wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );

}
?>

created style.css file inside the same dir that only contains:

/*
Theme Name: Twenty Fifteen AR
Theme URI: https://wordpress.org/themes/twentyfifteen/
Author: me
Version: 1.0
Template: twentyfifteen
*/

After that, activated the newly appearing theme Twenty Fifteen AR but nothing changed from the parent theme. What am I missing please?

Follow Up Question:

I want to add this to CSS of rtl.css file for example (where to put this code?)

.wpcf7
        {
            background-color: #f7f7f7;
            border: 2px solid #0f0;
        }

Trials:

  1. when created rtl.css inside child theme folder and added this code, website didn't pick up the change.
  2. Worked only when I added this code in the parent rtl.css file of the parent 2015 theme, but I know this is not the best practice as it will soon be replaced of the new version of the theme when is out there. So how should I add this code in this case?
2

You also need to include the RTL.css file which is in the theme too:

add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
function my_theme_enqueue_styles() {
 wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
  wp_enqueue_style( 'rtl-style', get_template_directory_uri() . '/rtl.css' );
}

To use the rtl.css from your theme directory change the code to:

add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
function my_theme_enqueue_styles() {
 wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
 wp_enqueue_style( 'rtl-style', get_stylesheet_directory_uri() . '/rtl.css' );
}

Make sure you copy everything from the original rtl.css file to your own.

| improve this answer | |
  • the parent theme twentyfifteen does have rtl.css file, do I need to create another rtl.css file inside the child theme directory? if yes, what should its content be? – doctorate Jun 8 '16 at 17:31
  • no, look at my code, I am puiling it in so it should then make the theme RTL – Gareth Gillman Jun 8 '16 at 17:32
  • I see, great, I tried your kindly provided code and it worked, now I have RTL 2015 theme. Thanks. – doctorate Jun 8 '16 at 17:34
  • wish I had enough points to add the tag right-to-left. – doctorate Jun 8 '16 at 17:35
  • 1
    Put whatever you want, they are just descriptive names – Gareth Gillman Jun 13 '16 at 15:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.