pdxsherpa — 2014-05-28T19:27:47-04:00 — #1
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?
bluedreamer — 2014-05-28T21:09:02-04:00 — #2
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">
oddz — 2014-05-29T00:04:44-04:00 — #3
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.
pdxsherpa — 2014-05-29T00:30:35-04:00 — #4
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.
mittineague — 2014-05-29T00:39:07-04:00 — #5
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.
pdxsherpa — 2014-05-29T22:53:21-04:00 — #6
guess a very simple way i hand't thought of is to just use
/* @import:url(../twentyfourteen/style.css); */