LESS CSS enqueue_style with add_filter to change rel attribute
Yep, final style link output is passed through style_loader_tag filter.
Yep, final style link output is passed through style_loader_tag filter.
Make sure you have the files named and labeled correctly and in the right place. functions.php located @ mytheme/functions.php <?php /** * Theme Functions */ function theme_name_scripts() { wp_enqueue_style( ‘style-name’, get_stylesheet_uri() ); wp_enqueue_style( ‘style-name’, get_stylesheet_uri() ); } add_action( ‘wp_enqueue_scripts’, ‘theme_name_scripts’ ); style.css located @ mytheme/style.css /* Theme Name: Twenty Thirteen Theme URI: http://wordpress.org/themes/twentythirteen Author: the … Read more
The wp_enqueue_style() function uses the following format and parameters: wp_enqueue_style( $handle, $src = false, $deps = array(), $ver = false, $media=”all” ); In your case, you could try the following: <?php /** * Proper way to enqueue scripts and styles */ function namespace_theme_stylesheets() { wp_enqueue_style( ‘mamies-wafers-bootstrap-min’, get_template_directory_uri() .’/css/bootstrap.min.css’, array(), null, ‘all’ ); wp_enqueue_style( ‘mamies-wafers-carousel’, get_template_directory_uri() … Read more
QUESTION 1 Is it safe to include the assumption that parent themes properly enqueue the child theme styles, from the standpoint of child theme standards? General rule of thumb, yes. But, you should never assume. Most disasters and failures in live are due to assumptions or facts based on an assumption FACTS WITHOUT ASSUMPTIONS A … Read more
2 questions so 2 answers 🙂 Why is the current functions.php not working and adding styles to all pages? I’m not sure if it’s the global call or the if statement… It doesn’t work because of the order in which these functions are called. Your shortcode callback is called during rendering post content (most probably … Read more
Take a look here at the CODEX for an example on how to do this very thing. Example: Load CSS File on All Admin Pages function load_custom_wp_admin_style(){ wp_register_style( ‘custom_wp_admin_css’, get_bloginfo(‘stylesheet_directory’) . ‘/admin-style.css’, false, ‘1.0.0’ ); wp_enqueue_style( ‘custom_wp_admin_css’ ); } add_action(‘admin_enqueue_scripts’, ‘load_custom_wp_admin_style’); Example: Target a Specific Admin Page function my_enqueue($hook) { if( ‘edit.php’ != $hook ) … Read more
I hope you know what you are doing. You can use the wp_print_styles and wp_print_scripts action hooks and then get the global $wp_styles and $wp_scripts object variables in their respective hooks. The “registered” attribute lists registered scripts and the “queue” attribute lists enqueued scripts on both of the above objects. An example code to empty … Read more
Enqueue the style.css too, and set normalize as dependency: if ( ! is_admin() ) { // Register early, so no on else can reserve that handle add_action( ‘wp_loaded’, function() { wp_register_style( ‘normalize’, // parent theme get_template_directory_uri() . ‘/css/normalize.css’ ); wp_register_style( ‘theme_name’, // current theme, might be the child theme get_stylesheet_uri(), [ ‘normalize’ ] ); }); … Read more
For every enqueue action, there is a corresponding print_styles action: wp_enqueue_scripts → wp_print_styles admin_enqueue_scripts → admin_print_styles customize_controls_enqueue_scripts → customize_controls_print_styles Not for the login page. There is no login_print_styles action or function, so your stylesheets are thrown out on do_action( ‘login_footer’ );. But there is a simple fix: if ( ! has_action( ‘login_enqueue_scripts’, ‘wp_print_styles’ ) ) … Read more
I copy pasted your code into my dev environment, changed nothing but the page name, and it works just fine. Are you sure that it’s not being enqueued and you just have it pointed wrong or that the page is not named incorrectly or something?