Articles of wp enqueue style

How the Css File is Linked without calling it in header.php?

everytime I analyze free theme, I am not able to find how the css file is linked in the theme. as far as i learned css file should be linked in header.php using link tag. but everytime I check themes I didn’t see any code in which they link their css through link tag. […]

Enqueue Style for a page/pages only

it is causing problem because i did not do it before. I am trying to enqueue style or may be scripts depending on page. But it not working. Here is the code: add_action(‘init’, ‘my_enqueue_styles’); function my_enqueue_styles(){ if(is_page(‘Add Event’)){ // also tried slug, page id and wp_reset_query(); bot not worked wp_deregister_style( ‘jquery-ui-custom-flick’ ); wp_register_style( ‘jquery-ui-custom-flick’, get_bloginfo(‘template_directory’) […]

Best spot for wp_register_script() and wp_register_style()

I need to enqueue multiple scripts and styles in my plugin. However, I do not like the idea of calling wp_register_script() and wp_register_style() every time I need to call wp_enqueue_script() and wp_enqueue_style(). I think it is a good idea to register the scripts and styles once, then call them as necessary as needed. So my […]

Advantages of using <link> instead of wp_enqueue_style()?

I’m working on a child theme for a base theme that mixes equal parts of <link> CSS and wp_enqueue_style() CSS. This base theme has me thinking – I don’t see any advantages to using <link>, other than that it may it’s a simpler solution for very simple themes. (for example, using <link> can be done […]

wp_enqueue_style with style.php and WordPress functions

I use wp_enqueue_style to add my stylesheet, like this: <?php wp_enqueue_style( ‘theme-style’, get_template_directory_uri() . ‘/style.php’, false, ‘1.0’, ‘all’ ); ?> It works fine BUT I need to run a WordPress function in the style.php file. The stylesheet file does not know that the core exists. This is what I’ve heard It’s bad to include wp-load.php. […]

using conditionals on enqueue styles

I want to run my css code on a specific page in admin area. What is the best approach please? A: function register_style() { if (is_page..something) { wp_enqueue_style(‘style’, PLUGIN_URL . ‘style.css’); } } add_action(‘admin_enqueue_scripts’, ‘register_style’); B: function register_style() { wp_enqueue_style(‘style’, PLUGIN_URL . ‘style.css’); } if (is_page..something) { add_action(‘admin_enqueue_scripts’, ‘register_style’); }

wp_enqueue_style will not let me enforce screen only

I am using Roots as the starter for a theme I have been working on. I then generated a print.css file, but in Chrome’s case, it still is using the bootstrap-responsive.css queries, and messing things up. This answer on SO explains the issue, and I know it fixes what I am having an issue with […]

Removing an action, or dequeueing style – Both not working

What I am wanting to achieve is to remove an action called inside of another action. The action is calling a style, and although I have tried to deregister, and dequeue the style, it is still displaying on the admin pages. Here is the code snippet (inside of WooCommerce): function woocommerce_admin_menu() { global $menu, $woocommerce;… […]

Enqueue stylesheets with the same name

Ok, maybe i’m thinking too difficult, but I have 2 stylesheets with the same name. One is from the parent theme folder, and one from the child theme folder. I want to enqueue the style from the child theme folder AFTER the parent theme style has loaded, so I can overrule some classes. This is […]

Include user defined styles without including wp-load

I’ve looked through the answers on here and none quite match my situation. I have custom CSS that a user can edit and it is saved in the options. I use wp_enqueue_style to include a PHP file with a CSS content header and then load the CSS from the options. However, in order to load […]