From d4f5ab233078114261c7392e5179420126804343 Mon Sep 17 00:00:00 2001 From: Andrew Minion Date: Tue, 24 Jan 2017 16:30:37 -0500 Subject: [PATCH 1/5] register and enqueue style in one call --- devdmbootstrap3/functions.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/devdmbootstrap3/functions.php b/devdmbootstrap3/functions.php index 0667889..6849573 100644 --- a/devdmbootstrap3/functions.php +++ b/devdmbootstrap3/functions.php @@ -27,8 +27,7 @@ //////////////////////////////////////////////////////////////////// function devdmbootstrap3_theme_stylesheets() { - wp_register_style('bootstrap.css', get_template_directory_uri() . '/css/bootstrap.css', array(), '1', 'all' ); - wp_enqueue_style( 'bootstrap.css'); + wp_enqueue_style('bootstrap.css', get_template_directory_uri() . '/css/bootstrap.css', array(), '1', 'all' ); wp_enqueue_style( 'stylesheet', get_stylesheet_uri(), array(), '1', 'all' ); } add_action('wp_enqueue_scripts', 'devdmbootstrap3_theme_stylesheets'); From c64e6cbd662a6dfca9f6cceca18aa707e5986184 Mon Sep 17 00:00:00 2001 From: Andrew Minion Date: Tue, 24 Jan 2017 16:31:09 -0500 Subject: [PATCH 2/5] =?UTF-8?q?use=20child=20theme=E2=80=99s=20bootstrap.c?= =?UTF-8?q?ss=20(if=20applicable)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- devdmbootstrap3/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devdmbootstrap3/functions.php b/devdmbootstrap3/functions.php index 6849573..f5c4d81 100644 --- a/devdmbootstrap3/functions.php +++ b/devdmbootstrap3/functions.php @@ -27,7 +27,7 @@ //////////////////////////////////////////////////////////////////// function devdmbootstrap3_theme_stylesheets() { - wp_enqueue_style('bootstrap.css', get_template_directory_uri() . '/css/bootstrap.css', array(), '1', 'all' ); + wp_enqueue_style('bootstrap.css', get_stylesheet_directory_uri() . '/css/bootstrap.css', array(), '1', 'all' ); wp_enqueue_style( 'stylesheet', get_stylesheet_uri(), array(), '1', 'all' ); } add_action('wp_enqueue_scripts', 'devdmbootstrap3_theme_stylesheets'); From 63a955dc45c04f275dfadcdf81eab843ba6529a1 Mon Sep 17 00:00:00 2001 From: Andrew Minion Date: Tue, 24 Jan 2017 16:31:25 -0500 Subject: [PATCH 3/5] use plugin version for stylesheet version number --- devdmbootstrap3/functions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/devdmbootstrap3/functions.php b/devdmbootstrap3/functions.php index f5c4d81..66859a7 100644 --- a/devdmbootstrap3/functions.php +++ b/devdmbootstrap3/functions.php @@ -27,8 +27,8 @@ //////////////////////////////////////////////////////////////////// function devdmbootstrap3_theme_stylesheets() { - wp_enqueue_style('bootstrap.css', get_stylesheet_directory_uri() . '/css/bootstrap.css', array(), '1', 'all' ); - wp_enqueue_style( 'stylesheet', get_stylesheet_uri(), array(), '1', 'all' ); + wp_enqueue_style('bootstrap.css', get_stylesheet_directory_uri() . '/css/bootstrap.css', array(), $version, 'all' ); + wp_enqueue_style( 'stylesheet', get_stylesheet_uri(), array(), $version, 'all' ); } add_action('wp_enqueue_scripts', 'devdmbootstrap3_theme_stylesheets'); From 38a6af5ffb874dcf7a6a1c11ab016e2b32b1334d Mon Sep 17 00:00:00 2001 From: Andrew Minion Date: Tue, 24 Jan 2017 16:32:51 -0500 Subject: [PATCH 4/5] use WP stylesheet enqueing rather than CSS @imports for better performance --- devdmbootstrap3-child/style.css | 2 +- devdmbootstrap3-sasschild/functions.php | 11 ----------- devdmbootstrap3-sasschild/style.css | 2 +- 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/devdmbootstrap3-child/style.css b/devdmbootstrap3-child/style.css index 4c27407..c11b45f 100644 --- a/devdmbootstrap3-child/style.css +++ b/devdmbootstrap3-child/style.css @@ -12,7 +12,7 @@ Text Domain: devdmbootstrap3 Template: devdmbootstrap3 */ -@import "css/bootstrap.css"; +/* The bootstrap.css file is auto-enqueued in functions.php */ /* YOU SHOULD BE MAKING A CHILD THEME. Don't let me be a bad guy and erase all your hard work with a theme update. I just want to bring you new amazing features. I don't want to destroy your world. I've include a child theme to use. Need help? http://devdm.com/DevDmBootstrap3/child-themes/ */ diff --git a/devdmbootstrap3-sasschild/functions.php b/devdmbootstrap3-sasschild/functions.php index 1553ed1..b3d9bbc 100644 --- a/devdmbootstrap3-sasschild/functions.php +++ b/devdmbootstrap3-sasschild/functions.php @@ -1,12 +1 @@ Date: Tue, 24 Jan 2017 17:12:22 -0500 Subject: [PATCH 5/5] pass $verison to enqueue function --- devdmbootstrap3/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devdmbootstrap3/functions.php b/devdmbootstrap3/functions.php index 66859a7..c4d99d1 100644 --- a/devdmbootstrap3/functions.php +++ b/devdmbootstrap3/functions.php @@ -25,7 +25,7 @@ //////////////////////////////////////////////////////////////////// // Enqueue Styles (normal style.css and bootstrap.css) //////////////////////////////////////////////////////////////////// - function devdmbootstrap3_theme_stylesheets() + function devdmbootstrap3_theme_stylesheets($version) { wp_enqueue_style('bootstrap.css', get_stylesheet_directory_uri() . '/css/bootstrap.css', array(), $version, 'all' ); wp_enqueue_style( 'stylesheet', get_stylesheet_uri(), array(), $version, 'all' );