<div dir="ltr">Why are "<span style="color:rgb(85,85,85);font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:13px;line-height:18.2000007629395px">Themes may </span><b style="color:rgb(85,85,85);font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:13px;line-height:18.2000007629395px">optionally</b><span style="color:rgb(85,85,85);font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:13px;line-height:18.2000007629395px"> link the default stylesheet (</span><tt style="color:rgb(85,85,85)">style.css</tt><span style="color:rgb(85,85,85);font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:13px;line-height:18.2000007629395px">) directly in the document head"?</span></div><div class="gmail_extra"><br><div class="gmail_quote">On 30 September 2014 10:07, Michael Hebenstreit <span dir="ltr"><<a href="mailto:michael@mhthemes.com" target="_blank">michael@mhthemes.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Hi Otto,<div><br></div><div>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. </div><div><br></div><div>Regards,<br><div>
<div>Michael</div>
</div>
<br><div><div>Am 30.09.2014 um 09:00 schrieb Otto <<a href="mailto:otto@ottodestruct.com" target="_blank">otto@ottodestruct.com</a>>:</div><div><div class="h5"><br><blockquote type="cite"><div dir="ltr">It would be best to say that that approach is allowed, but doing it with enqueue is probably somewhat better form.<div><br></div><div>If you examine Twenty Fourteen, you'll see that it has a function in the functions.php file called <span style="white-space:pre-wrap">twentyfourteen_scripts(). This function is hooked to the "</span><span style="white-space:pre-wrap">wp_enqueue_scripts" action hook, and it loads all the various scripts and styles and such </span></div><div><br></div><div>One of those styles is the main stylesheet, determined by get_stylesheet_url(). It adds that stylesheet like this:</div><div><br></div><div>wp_enqueue_style( 'twentyfourteen-style', get_stylesheet_uri(), array( 'genericons' ) );<br></div><div><br></div><div>Note that it also declares the main theme stylesheet dependent on the genericons stylesheet as well, to ensure that that stylesheet is also loaded.</div><div><br></div><div>Having your stylesheets declared like this and enqueued can make them easier to organize and reference, especially if your theme is complex.</div><div class="gmail_extra"><br clear="all"><div>-Otto</div>
<div class="gmail_extra"><br></div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div><br><div class="gmail_quote">On Tue, Sep 30, 2014 at 12:56 AM, Emil Uzelac <span dir="ltr"><<a href="mailto:emil@uzelac.me" target="_blank">emil@uzelac.me</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">no problem :)<div><span></span><br><br>On Tuesday, September 30, 2014, Michael Hebenstreit <<a href="mailto:michael@mhthemes.com" target="_blank">michael@mhthemes.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word"><div>Good to know - thanks for the link. :-)
</div><div><br></div>
<br><div><div>Am 30.09.2014 um 07:48 schrieb Emil Uzelac <<a>emil@uzelac.me</a>>:</div><br><blockquote type="cite">Sorry but the correct answer is yes <span></span><a href="https://make.wordpress.org/themes/handbook/guidelines/template-tags-and-hooks/#including-stylesheets-and-scripts" target="_blank">https://make.wordpress.org/themes/handbook/guidelines/template-tags-and-hooks/#including-stylesheets-and-scripts</a><br><br>On Tuesday, September 30, 2014, Michael Hebenstreit <<a>michael@mhthemes.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi,<br>
<br>
no, you should enqueue stylesheets like this: <a href="http://codex.wordpress.org/Function_Reference/wp_enqueue_style" target="_blank">http://codex.wordpress.org/Function_Reference/wp_enqueue_style</a><br>
<br>
Cheers,<br>
Michael<br>
<br>
<br>
Am 30.09.2014 um 07:39 schrieb mudthemes support <<a>contact@mudthemes.com</a>>:<br>
<br>
> I have created a theme and have put stylesheet (style.css) into the <head> section of header.php using the following code:<br>
><br>
> <link rel="stylesheet" href="<?php echo get_stylesheet_uri() ?>" type="text/css" media="all" /><br>
> <?php wp_head(); ?><br>
> </head><br>
><br>
> The question is that whether this is prohibited or is it okay?<br>
> _______________________________________________<br>
> theme-reviewers mailing list<br>
> <a>theme-reviewers@lists.wordpress.org</a><br>
> <a href="http://lists.wordpress.org/mailman/listinfo/theme-reviewers" target="_blank">http://lists.wordpress.org/mailman/listinfo/theme-reviewers</a><br>
<br>
_______________________________________________<br>
theme-reviewers mailing list<br>
<a>theme-reviewers@lists.wordpress.org</a><br>
<a href="http://lists.wordpress.org/mailman/listinfo/theme-reviewers" target="_blank">http://lists.wordpress.org/mailman/listinfo/theme-reviewers</a><br>
</blockquote>
_______________________________________________<br>theme-reviewers mailing list<br><a>theme-reviewers@lists.wordpress.org</a><br><a href="http://lists.wordpress.org/mailman/listinfo/theme-reviewers" target="_blank">http://lists.wordpress.org/mailman/listinfo/theme-reviewers</a><br></blockquote></div><br></div></blockquote>
</div><br>_______________________________________________<br>
theme-reviewers mailing list<br>
<a href="mailto:theme-reviewers@lists.wordpress.org" target="_blank">theme-reviewers@lists.wordpress.org</a><br>
<a href="http://lists.wordpress.org/mailman/listinfo/theme-reviewers" target="_blank">http://lists.wordpress.org/mailman/listinfo/theme-reviewers</a><br>
<br></blockquote></div><br></div></div>
_______________________________________________<br>theme-reviewers mailing list<br><a href="mailto:theme-reviewers@lists.wordpress.org" target="_blank">theme-reviewers@lists.wordpress.org</a><br><a href="http://lists.wordpress.org/mailman/listinfo/theme-reviewers" target="_blank">http://lists.wordpress.org/mailman/listinfo/theme-reviewers</a><br></blockquote></div></div></div><br></div></div><br>_______________________________________________<br>
theme-reviewers mailing list<br>
<a href="mailto:theme-reviewers@lists.wordpress.org">theme-reviewers@lists.wordpress.org</a><br>
<a href="http://lists.wordpress.org/mailman/listinfo/theme-reviewers" target="_blank">http://lists.wordpress.org/mailman/listinfo/theme-reviewers</a><br>
<br></blockquote></div><br></div>