[theme-reviewers] Best Practice Question: style.css

Sami Keijonen sami.keijonen at foxnet.fi
Mon Aug 4 09:08:47 UTC 2014


This works when parent theme is active. But when child theme is active,
rtl.css is not loaded.

There are at least two ways to handle this.

1. Use selectors .rtl in parent theme style.css.

.rtl #some {

}

2. Load style-rtl.css or style-rtl.min.css file when is_rtl is true.

/* Enqueue parent theme styles. */
wp_enqueue_style( 'theme-style', trailingslashit(
get_template_directory_uri() ) . 'style' . THEME_SUFFIX . '.css', array(),
THEME_VERSION );


/* Enqueue right to left styles. */
if ( is_rtl() ) {
wp_enqueue_style( 'theme-rtl-style', trailingslashit(
get_template_directory_uri() ) . 'style-rtl' . THEME_SUFFIX . '.css',
array( 'theme-style' ), THEME_VERSION );
}

We could generate RTL styles with Janus Grunt task but in my case it still
needs some manually work. So I just write RTL styles manually.

https://github.com/yoavf/grunt-cssjanus


On 4 August 2014 10:09, Sami Keijonen <sami.keijonen at foxnet.fi> wrote:

> Hmmm rtl.css might not be loaded properly with this way. Need to test some
> more.
>
>
> On 1 August 2014 21:03, Emil Uzelac <emil at uzelac.me> wrote:
>
>> It should be good, I have not find any issues with that. Not sure what
>> others think.
>>
>>
>> On Friday, August 1, 2014, Sami Keijonen <sami.keijonen at foxnet.fi> wrote:
>>
>>> Emil, is you example loading parent and child theme style.css allowed in
>>> .org? It's seems handy way of loading parent theme's style.min.css file.
>>>
>>>
>>> On 16 July 2014 22:36, Emil Uzelac <emil at uzelac.me> wrote:
>>>
>>>> Empties are ugly and not really needed.
>>>>
>>>> This is what I do for my clients:
>>>>
>>>>     // Parent theme style.
>>>>  wp_enqueue_style( 'my-style', get_template_directory_uri() .
>>>> '/style.css', array(), null );
>>>>  // Child theme style.
>>>>     if ( is_child_theme() ) {
>>>> wp_enqueue_style( 'my-child-style', get_stylesheet_uri(), array(), null
>>>> );
>>>>  }
>>>>
>>>> Parent style.css remains at the usual place and when child is active it
>>>> will add it's own stylesheet :)
>>>>
>>>> And of course no @imports either ;)
>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> theme-reviewers mailing list
>>>>> theme-reviewers at lists.wordpress.org
>>>>> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> theme-reviewers mailing list
>>>> theme-reviewers at lists.wordpress.org
>>>> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>>>>
>>>>
>>>
>>>
>>> --
>>> Sami Keijonen
>>> Fox Holding Oy
>>> sami.keijonen at foxnet.fi
>>> foxnet.fi
>>> foxnet-themes.fi
>>>
>>
>> _______________________________________________
>> theme-reviewers mailing list
>> theme-reviewers at lists.wordpress.org
>> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>>
>>
>
>
> --
> Sami Keijonen
> Fox Holding Oy
> sami.keijonen at foxnet.fi
> foxnet.fi
> foxnet-themes.fi
>



-- 
Sami Keijonen
Fox Holding Oy
sami.keijonen at foxnet.fi
foxnet.fi
foxnet-themes.fi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wordpress.org/pipermail/theme-reviewers/attachments/20140804/fa2b1f24/attachment.html>


More information about the theme-reviewers mailing list