CMS & WordPress
It has been a while since i have had to do it.
this is what i am going with:
<link type="text/css" rel="stylesheet" href="<?php echo get_stylesheet_directory_uri();?>css/bootstrap.css">
<link type="text/css" rel="stylesheet" href="<?php echo get_stylesheet_directory_uri();?>css/bootstrap.min.css">
<script src="<?php echo get_stylesheet_directory_uri(); ?>js/bootstrap.js" ></script>
<script src="<?php echo get_stylesheet_directory_uri(); ?>js/bootstrap.min.js"></script>
<script src="<?php echo get_stylesheet_directory_uri(); ?>js/jquery-1.11.1.min.js"></script>
In the head section. Am i doing this right? would another approach be better?
Wouldn't it be better to use hard coded relative URL's to save the PHP overhead? eg
<link type="text/css" rel="stylesheet" href="/assets/css/bootstrap.css">
My first question would be whether the parent theme hard codes the assets into the template. If it does than I would say with 99% certainty you will also have to hard code those assets into your child theme. However, if the assets are not hard coded than it would be best to have the child theme programmatically inherit all the assets. However, I'm not certain there is a way in Wordpress to do that. However, I know for a fact there is a way in Drupal 7+. Hard coding anything is rarely a good thing especially when it comes to an inheritance chain.
Edit: You must be doing something wrong because the below tutorial states that asset files will be automatically inherited. Perhaps your using a older version or something that didn't provide that capability.
Blue, Oddz. thank you.
I'll try the hard coding first, but i thought w/wordpress you have to use the php tags or to enque ( i suck at it) the thing.
I am using a child theme. and by calling it in w/the style sheet i am inherith the assets, functions and all. and the new style.css of course will over ride what needs to be overridden in the parent theme.
However I am also throwing in bootstrap. So am trying to link it in.
I'm guessing what you posted is for example purposes only? i.e both non-min and min versions are likely to cause problems.
Being WordPress and using templates as it does, I don't think hardcoding would result in too much maintenance costs.
And I don't see where using a script generated path prefix with hard coded file names would be much help.
I suppose you could use a type of config file to DEFINE paths/files CONSTANTS if you wanted to keep the info in a single file.
guess a very simple way i hand't thought of is to just use
/* @import:url(../twentyfourteen/style.css); */
This topic is now closed. New replies are no longer allowed.