2

I'm working on a child theme for a base theme that mixes equal parts of <link> CSS and wp_enqueue_style() CSS. This base theme has me thinking - I don't see any advantages to using <link>, other than that it may it's a simpler solution for very simple themes. (for example, using <link> can be done without a functions.php file)

As far as I can tell, <link> is less flexible than wp_enqueue_style(), and using a combination of <link> and wp_enqueue_style() just makes things downright convoluted. Am I missing something?

3
  • Note: I'm aware of the questions about advantages of wp_enqueue_style() over <link>, but as you can see, this question is a little different than that. Thanks for stopping by!
    – rinogo
    Sep 27, 2017 at 3:06
  • Also, I discovered another potential niche/advantage: inclusion of CSS via conditional comments (e.g. <!--[if lt IE 9]><link ... /><![endif]-->)
    – rinogo
    Sep 27, 2017 at 3:11
  • 1
    you are trying to compare an html elelement to an API. I am not sure how exactly this can be compared at all. Sep 27, 2017 at 3:29

1 Answer 1

3

First of all, you must need a functions.php to create a theme whether it's a parent theme or child theme. Now if you are gonna need a functions.php must then why don't you also use it for enqueuing styles and scripts ! Besides when it is the best practice.

Now if your base theme or parent theme uses <link> or combination of <link> and wp_enqueue_style() then they are doing it wrong. Or they are not aware of or don't care of anything in future can happen. As I already said this a very bad practice and it can be a pain in future if you are gonna maintain the theme for a long time. Also it's not child theme friendly. For your case I think this can be such a pain to create a child theme form this kinda parent theme.

And for your IE related comment please have a look here.

Hope this will help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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