Cornerstone is a WordPress starter theme based on the Zurb Foundation Responsive Framework. Cornerstone aims to provide a lightweight starter theme that is responsive and SEO friendly that web designers can build great looking websites on.
GNU General Public License v2.0
155
stars
40
forks
source link
adding cornerstone_asset_uri function to serve child theme assets if the... #23
In order to better equip this theme for child themes, it's important that the assets like CSS and JS loaded in the theme pull from the child theme first if the file exists-- and if not, load the main template asset.
I checked the WP codex and get_stylesheet_directory_uri(), as far as I understand it, would error if there are no assets in the child theme where they exist in the parent theme. In order to optionally serve those assets if they exist, I created a function that checks for a file in the child theme and returns that path to the asset. If there's no file there, it returns the path to the asset in the parent template directory.
...y exist.
In order to better equip this theme for child themes, it's important that the assets like CSS and JS loaded in the theme pull from the child theme first if the file exists-- and if not, load the main template asset.
I checked the WP codex and get_stylesheet_directory_uri(), as far as I understand it, would error if there are no assets in the child theme where they exist in the parent theme. In order to optionally serve those assets if they exist, I created a function that checks for a file in the child theme and returns that path to the asset. If there's no file there, it returns the path to the asset in the parent template directory.