Questions tagged [wp-enqueue-style]

A safe way to add/enqueue a CSS style file to the wordpress generated page. If it was first registered with wp_register_style() it can now be added using its handle.

Filter by
Sorted by
Tagged with
0
votes
1answer
36 views

Wordpress plugin enqueue scripts working for js, but not css files

I am trying to load custom css specifically relevant to the plugin. The js is working perfectly fine, but the css just refuses to get loaded in. Here is the code: function admin_plugin_scripts(){ ...
0
votes
1answer
26 views

Stylesheet is getting removed/deregistered automatically

I've put some custom code in my active child theme's functions.php. I'm trying to enqueue some style on a admin page. However, a style enqueued in admin_enqueue_scripts hook gets automatically removed ...
0
votes
1answer
325 views

enqueing Javascript and CSS

Whenever I check my website on gtmetric, google Insights, Pingdom etc... I always get feed back of render blocking JS Currently I enqueue all my scripts as so: <head> <link rel="...
0
votes
1answer
61 views

Edit CSS of a plugin

I'd like to edit a CSS file that is located at wp-content/plugins/woocommerce-gateway-stripe/assets/css/stripe-styles.css, I tried to overwrite it by placing the edited css in my child theme at wp-...
0
votes
1answer
385 views

How can I get this child theme stylesheet to properly load? Or if it is correct, why doesn't my child theme appearance match the parent?

I've read the Codex article on child themes, and numerous StackExchange Q&As, but I've not been able to get this figured out. The impact is that my child theme does not exhibit the same styling as ...
1
vote
3answers
342 views

Child theme .css files are not overriding their parent .css files

In the last month I have been creating my very first website. Before this I had no coding knowledge so everyhting I learnt was new to me. My problem over the last week is that my child theme .css ...
0
votes
1answer
330 views

How to enqueue a theme style-sheet to my admin settings page?

I have a situation in which I am building a plugin that is intentionnally fit for a particular theme. Within my theme I have the following folder structure leading to my css file. wp-content -> ...
0
votes
1answer
36 views

Custom plugin - load enqueue only for this plugin

I have made my own plugin, which works fine, but I'm enqueueing (is that a word?) bootstrap, which then loads cross-site (admin). I found some workarounds, but the current workaround I'm trying throws ...
0
votes
3answers
175 views

What is the difference between the different ways of linking stylesheets

I'm only just learning WP theme development so this may be a very stupid question, but I have noticed there are different ways to link to the main stylesheet from the index.php: <?php bloginfo('...
0
votes
1answer
368 views

Parent theme styles overriding child theme CSS [closed]

I am having some trouble getting my child theme to work perfectly. I have successfully created a child theme based on the Flexia theme. I have made child themes before but not come across this issue ...
-2
votes
2answers
52 views

How to create my own style.css file in an wordpress child-theme

I am working in the theme called Understrap. I work in the child-theme. The theme allready has a style.css and functions.php. I want to create my own style.css file and overwrite that style.css ...
0
votes
1answer
415 views

Relative path instead of absolute for wp_enqueue_script

When you enqueue scripts or styles with the following: function themeslug_enqueue_style() { wp_enqueue_style( 'core', '/style.css', false ); } add_action( 'wp_enqueue_scripts', '...
1
vote
2answers
68 views

How to remove scripts/style added to customize_controls_enqueue_scripts hook by current active theme

I am looking for a way to remove/unhook all assets (css and javascript) files added to customize_controls_enqueue_scripts hook when the query string mo-reset=true is added to the customize url.
0
votes
1answer
229 views

How can I move my custom css to the very bottom of the head section?

I have a code, which includes my custom css file to the of the template: add_action('wp_enqueue_scripts', 'add_custom_css'); function add_custom_css() { wp_enqueue_style('custom-styles', ...
1
vote
0answers
338 views

Custom style sheet won't enqueue / load if the css file actually exists. [closed]

The symptoms of my problem are different from other similar questions, on this forum and others. I'm using a local instance of WP, using the 33 theme, on XAMPP, and with a virtual domain, something ...
0
votes
2answers
355 views

I can't add CSS with functions.php [SOLVED]

I'm relatively new to creating a theme with WordPress, and I've been adding all the stylesheets (main and for each page) with the old echo get_stylesheet_uri();. But I find out that this isn't the ...
1
vote
2answers
574 views

Is it possible to enqueue CSS files from plugin before theme's CSS files?

If I enqueue styles from my plugin, then it loads after theme's styles. That's why some CSS of my plugin is overriding by theme's CSS. This problem would be fixed if I can ensure my plugin's styles ...
0
votes
1answer
333 views

The CSS (style.css) Of My Custom Theme Is Not Being Applied At All

I am creating my own theme Wordpress, however the CSS I wrote for the theme design is not being applied at all. It's saved in style.css and I have applied the following in my functions.php file: <...
2
votes
2answers
490 views

“wp_enqueue_style();” don't load new edited style

First, sorry my english. I am using Local by flywheel to manager my site files and my wordpress version is 4.9.4. Here is the problem, When I use wp_enqueue_style('wharever', get_stylesheet_uri()); ...
0
votes
2answers
350 views

Load custom CSS before admin CSS

I am trying to use the jQuery Datatables plugin in my WordPress dashboard but the native WordPress admin CSS styling is overiding the datatables CSS, I am calling them like this... add_action('...
-1
votes
1answer
1k views

How can I dequeue a Plugin Stylesheet?

I am currently using a Plugin, which has created a Stylesheet within the following directory: /wp-content/uploads/plugin-name/css. I would like to remove this Plugin's Stylesheet, since it is being ...
0
votes
1answer
301 views

How do I dequeue a Stylesheet, stored in an 'Assets' folder?

How do I dequeue a CSS Stylesheet located in wp-content > themes > theme-name > assets > css > theme-skin > color.css? The outputted code, within the Source Code, is: <link rel='...
0
votes
1answer
299 views

Should I use `get_stylesheet_uri()` or `get_template_directory_uri()` when calling my CSS Stylesheet?

I am building a WordPress Theme, from the ground up. At present, I have placed a style.css file within the wp-content/themes/theme-name directory. The current information, within this file, is as ...
0
votes
1answer
708 views

How to insert html/css/javascript code to wordpress plugin

I'm trying to show a modal dialog when user get registered (action_hook: user_register) using the woocommerce plugin, but without having any result. I would appreciate any help! The code is shown ...
0
votes
1answer
23 views

my custom css file downloads then it STOPS!

I’m watching an online course for WordPress development and at the beginning I attached the css file the exact like what the instructor did and tested it by adding some styles and it worked fine ...
0
votes
1answer
668 views

Child theme stylesheet not always overriding “index”

I'm using a child theme and I'm using a "styles.css" file to override things from the parent theme. My styles (there are many stylesheets) are enqueued like this: function my_theme_enqueue_styles() { ...
1
vote
3answers
3k views

How to load different css file for different pages

I have several different pages. Every one of them has different css links. Rather than the css links all items are same in the head element of those pages. I need to shift those head element to header....
0
votes
1answer
39 views

Theme JS is available but theme CSS isn't

In functions.php I used the following code to enqueue assets, but for some reason all CSS is ignored (JS isn't ingonred): function my_theme_enqueue_assets() { wp_enqueue_style( 'parent-style', ...
1
vote
0answers
48 views

Additional CSS - crashing with javascript-html minifier?

How can I load Additional CSS style manually in functions.php? This is how I load my css files and js files: function xxx_scripts() { // Load our CSS bundle. wp_enqueue_style('xxx-master-...
1
vote
2answers
96 views

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

everytime I analyze free wordpress.org 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 ...
0
votes
2answers
44 views

Enqueue style for specific site type

I want to import a style only on specific site types (articles (single.php), categories (category.php) and 404 page (404.php)). I tried to use is_page() but I don't know if it works for different site ...
1
vote
1answer
21 views

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', ...
1
vote
1answer
23 views

Theme in wp-content but my index.php search theme files in root

My file is in i.e in domain.com/wp-content/Themename/css/cssfile.css But for example css files are looked in domain.com/css/cssfile How to change this? The site isn't loading anything properly ...
0
votes
2answers
1k views

Bootstrap navbar responsiveness on WordPress theme menu not working

The theme I am creating is not working correctly. The menu is not collapsing into mobile view with the hamburger icon when I decrease screen size. I can see all the classes when using the inspect tool ...
0
votes
2answers
109 views

Child Theme not loading multiple stylesheets

I have little experience with creating a Child Theme. Just want to make some changes to css on the website. When I use the inspect mode to see which CSS was being used, I saw it was still linking to ...
0
votes
1answer
582 views

Enqueue styles properly in a child theme and stylesheets location

I have inherited a site without a child theme and now we will have problems when it comes to update things. Everything in this theme was made on the main theme... I have now created a child theme but ...
0
votes
2answers
466 views

How to register and set http/2 server prefetch for a specific asset?

I have been using, this plugin and its says WordPress 4.6 introduced native support for resource hints. By default, this plugin defers to WordPress 4.6 and theme/plugin developers to responsibly ...
0
votes
1answer
133 views

dynamic name of the style for wp_enqueue_style

I want to use a variable inside the function wp_enqueue_style(), right now the only way i figure out to do so is to define a constant but it needs to be variable define( 'NAME', 'mystyle' ); ...
0
votes
2answers
303 views

Proper Way to Load stylesheet on Condition

I am creating a child theme for my site and inside my functions.php I added a code to load a specific css file ONLY where it is the HOME page: // enqueue styles for child theme function ...
1
vote
1answer
225 views

How to dequeue theme's RTL stylesheet?

I'm developing a plugin that has its own templates to render the page. This includes header, content, footer, etc. Therefore I have to dequeue every other style added by either theme or plugins, in ...
0
votes
2answers
53 views

Enqueue a file that's not js or css

I want to register a new css document that I'm storing inside a PHP file (so that I can create variable css rules). I tried doing this: function tps_admin_scripts() { $plugin_url = plugin_dir_url( ...
0
votes
1answer
22 views

Including CSS files in HEAD based on page content

For example: I have a plugin that adds a box to the page. Box requires CSS file and JS file. Box can be added via shortcode, or via PHP or via widget. My question is - how to include CSS & ...
0
votes
2answers
457 views

responsive.css in the Wordpress should be prioritized

wp_enqueue_style( 'style', THEMEROOT . '/css/style.css' ); wp_enqueue_style( 'responsive', THEMEROOT . '/css/responsive.css' ); I am using the above method to enqueue stylesheet, but what I want is ...
-1
votes
1answer
1k views

Why is wp_enqueue_style not working?

Here's my code: class BWP_PostGrid { function __construct () { add_action('admin_init', array($this, 'plugin_initializer')); add_shortcode('bwp_post_grid', array($this, '...
0
votes
0answers
1k views

Visual composer addon load javascript/css only on pages using the addon

I am creating an addon for Visual Composer through vc_map and I am adding the javascript/css scripts needed by my addon to work on the website pages through /* Load plugin css and javascript files ...
2
votes
2answers
1k views

is_front_page not working in functions.php

I am trying to include a CSS file using wp_enqueue_style conditionally on whether I am on the front page. I am testing for the home page with this code: if ( is_front_page() ) wp_enqueue_style ('...
0
votes
1answer
565 views

How to call a static function in add_action() inside another static function?

In my plugin, I would like to load css only when the front-end current page is using one of my plugin shortcodes. All my shortcodes are classes extending Shortcode class. Shortcode class helps me to ...
0
votes
1answer
413 views

Register and enqueue style.css custom theme

I'm trying to create a custom theme for wordpress, I created all these file: style.css index.php function.php footer.php header.php page.php single.php front-page.php This is the code of my style....
3
votes
3answers
1k views

Does wordpress wp_enqueue_style support noscript?

I want to add stylesheet wrapped in noscript tag for a custom theme. Does wp_enqueue_style has any support for it? Or should I just include it like we do normally in html?
1
vote
1answer
780 views

Priority loading file css in child theme

I'm trying to add other file css to child theme. I have a style.css file in child theme, but it's loaded by default, so I hadn't to add it in head. Now I want to add other css file for responsive ...