[theme-reviewers] Need clarification on guidelines
Michael Hebenstreit
michael at mhthemes.com
Tue Sep 30 07:07:26 UTC 2014
Hi Otto,
thanks for the clarification. That’s actually what I also meant with my answer. I thought that doing it with the function is the only correct way. I was not aware that the guideline says that you can also add the stylesheet manually to the header.php. I also don’t think that it’s good to have this as a guideline as some novice authors may think that’s it’s a good approach to just load stuff in header.php instead of using a hook properly.
Regards,
Michael
Am 30.09.2014 um 09:00 schrieb Otto <otto at ottodestruct.com>:
> It would be best to say that that approach is allowed, but doing it with enqueue is probably somewhat better form.
>
> If you examine Twenty Fourteen, you'll see that it has a function in the functions.php file called twentyfourteen_scripts(). This function is hooked to the "wp_enqueue_scripts" action hook, and it loads all the various scripts and styles and such
>
> One of those styles is the main stylesheet, determined by get_stylesheet_url(). It adds that stylesheet like this:
>
> wp_enqueue_style( 'twentyfourteen-style', get_stylesheet_uri(), array( 'genericons' ) );
>
> Note that it also declares the main theme stylesheet dependent on the genericons stylesheet as well, to ensure that that stylesheet is also loaded.
>
> Having your stylesheets declared like this and enqueued can make them easier to organize and reference, especially if your theme is complex.
>
> -Otto
>
>
>
>
> On Tue, Sep 30, 2014 at 12:56 AM, Emil Uzelac <emil at uzelac.me> wrote:
> no problem :)
>
>
> On Tuesday, September 30, 2014, Michael Hebenstreit <michael at mhthemes.com> wrote:
> Good to know - thanks for the link. :-)
>
>
> Am 30.09.2014 um 07:48 schrieb Emil Uzelac <emil at uzelac.me>:
>
>> Sorry but the correct answer is yes https://make.wordpress.org/themes/handbook/guidelines/template-tags-and-hooks/#including-stylesheets-and-scripts
>>
>> On Tuesday, September 30, 2014, Michael Hebenstreit <michael at mhthemes.com> wrote:
>> Hi,
>>
>> no, you should enqueue stylesheets like this: http://codex.wordpress.org/Function_Reference/wp_enqueue_style
>>
>> Cheers,
>> Michael
>>
>>
>> Am 30.09.2014 um 07:39 schrieb mudthemes support <contact at mudthemes.com>:
>>
>> > I have created a theme and have put stylesheet (style.css) into the <head> section of header.php using the following code:
>> >
>> > <link rel="stylesheet" href="<?php echo get_stylesheet_uri() ?>" type="text/css" media="all" />
>> > <?php wp_head(); ?>
>> > </head>
>> >
>> > The question is that whether this is prohibited or is it okay?
>> > _______________________________________________
>> > 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
>> _______________________________________________
>> 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
>
>
> _______________________________________________
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wordpress.org/pipermail/theme-reviewers/attachments/20140930/8f3ca701/attachment.html>
More information about the theme-reviewers
mailing list