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.

77 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
3
votes
1answer
222 views

How to use parent theme's enqueue methods

According to the codex, when creating a child theme, you have to manually enqueue the parent theme's scripts. My parent theme has logic to conditionally display various css files, cached css, and ...
3
votes
0answers
296 views

iris color picker in widget - click event doesn't fire when initially when widget is first created

I added the wordpress(iris) color picker to a widget, and the color picker is not clickable when the widget is first created. My guess is that it's where/how the javascript file is being enqueued, but ...
2
votes
1answer
52 views

Dequeue theme stylesheets but keep widget styling on custom page template

Bit of an unusual one. I have created a plugin that will only display content on a custom page template. For this reason, I have dequeued all the theme styles via $wp_styles and loaded in the plugin ...
2
votes
2answers
123 views

How can I enqueue a style only when a particular widget is active?

I have a plugin which requires a style sheet for the widget. I am trying to register the stylesheet when the widget is created, however the style sheet is not being queued and the styles ignored. The ...
2
votes
0answers
296 views

Combining multiple stylesheets into one conditional block

I have multiple IE specific stylesheets that I need to add to my theme (combining them is not an option at this time), in addition to the standard ones. I am able to get this to work using the ...
2
votes
0answers
98 views

How to load script-related styles automatically?

Scenario: It is common that a JS dependency is bundled with a style file to work properly (just think about your favorite slideshow jQuery plugin). AFAIK, in this situation, the script and style have ...
1
vote
0answers
490 views

Preload key requests using wp_enqueue

I'm currently doing some speed optimisation and one of the main things scoring the site down is:- "Preload key requests 2.64 s Consider using to prioritize fetching resources that are currently ...
1
vote
0answers
51 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
1answer
70 views

Can't catch enqueued style

I'am stuck in catching enqueued style. I try to optimize website for PageSpeed. Site use plugin WPBakery Visual Composer as WYSIWYG editor. Every block supports Google Fonts, which added with ...
1
vote
1answer
316 views

How remove render blocking css from wordpress when you build a theme?

Is there any good way to avoid render blocking css (google page speed) from Wordpress. Probably more complex, but find a way to add in theme development. It means, not something very specific but ...
1
vote
1answer
304 views

enqueue styles for only mobile wp

I tried to enqueue some styles on mobile only using wp_is_mobile() function, but it always give me true, Here is the code (From functions.php file) : add_action('wp_enqueue_scripts','...
1
vote
0answers
2k views

why this media query is not working / not loading when I put it in child theme?

I am trying to create a separate style sheet for responsive behavior in a site. my folder structure: magzine/style.css magazine-child/style.css magazine-child/responsive.css Magazine is my theme ...
1
vote
0answers
102 views

How do I view registered syles and scripts for enqueue

I know that wp_register_style(), wp_deregister_style() and wp_enqueue_style() are used for css style registration and enqueue management. However, I am interested in viewing ALL registered styles (...
1
vote
0answers
98 views

Need help enqueueing webfonts

I am attempting to enqueue web fonts that I am loading in via the WebINK font library. (This service is similar to Typekit). This service works by generating a unique CSS link for each unique site. I ...
0
votes
2answers
40 views

functions.php - inject inline css from file

I would like to read from a .css file and inject it as an inline style in wp_head. it's possible? i've tried this "Add inline css to theme" solution but it doesn't do what I expect because I expect ...
0
votes
0answers
20 views

How to avoid conflict if a plugin already have included open library?

I am trying to use the swiper the library. https://idangero.us/swiper/get-started/ But the Elementor plugin is already added that : https://github.com/elementor/elementor/tree/master/assets/lib/...
0
votes
0answers
21 views

Scripts and stylesheets failing to load in Chrome IOS (and only Chrome IOS)

My script and stylesheet files have been failing to load in Chrome IOS, and only Chrome IOS. I changing the value of $ver in wp_register_script from a string with a value ("1.0.17") to an empty string,...
0
votes
0answers
30 views

Webpack 4: combine core and plugins in unique build/admin.js?

I'm going through @wordpress/scripts but it's not clear to me how to emit a unique 'build/output.js' which would combine / merge all the assets (admin and plugins) through webpack 4. Let me explain. ...
0
votes
0answers
18 views

different stylesheets for different languages

I want to translate an LTR wordpress theme to RTL. The theme uses bootstrap and includes bootstrap.min.css. But for RTL mode I need to include a different bootstrap css file named bootstrap-rtl.min....
0
votes
1answer
32 views

How to enqueue a script on a specific URL that contains multiple parts

I've tried using is_page() to pass the URL to but the page I am trying to enqueue my script on is "races/community/add" and isn't a single slug like "about-us". Is it possible to do this with is_page()...
0
votes
1answer
14 views

Can't Workout Dependency of Stylesheets

I have enqueued a new stylesheet rk.css Ultimately I want it to load last after all other plugin css etc to override any css. I have the following in my functions.php of my child theme: add_action( '...
0
votes
1answer
161 views

Wordpress and Advanced Custom Fields and Flickity

I am trying to add [Flickity Carousel][1] into my Wordpress theme. I was successful yesterday. However, when I returned to my theme this morning the carousel files are not loading. I am not sure what ...
0
votes
1answer
77 views

enqueue admin styling and scripts only on plugin page

I'm still learning so please bear with me if I sound a little confusing. Having lots of fun BTW while I learn. I'm creating a plugin with admin specific JS and CSS but I don't want those scripts and ...
0
votes
2answers
252 views

Gutenberg blocks not getting styled on back end

I am creating a plugin with custom gutenberg blocks. Each block has a styles.scss file. If I add code to this file, the block is styled in both the back end and front end, as expected per the docs. ...
0
votes
0answers
410 views

How to remove Google fonts from wp-admin (Roboto) added by core

This line is in source of /wp-admin/ code. I do not wish to have extra Google fonts in Wordpress admin area. <link rel='stylesheet' id='prefix-style-css' href='https://fonts.googleapis.com/css?...
0
votes
3answers
70 views

How do I create a child theme from PowerMag theme

I am using PowerMag 2.5 as parent and can't seem to find a way to get a working child theme. As far as I am now, I can only extend css in the style.css but as far as overriding, nothing has worked. ...
0
votes
1answer
24 views

Font size decreases when child theme is created from parent theme?

While creating and activating the child theme, the font size decreases as compared to parent theme <?php function my_theme_enqueue_styles() { $parent_style = 'spicepress-style'; // This is '...
0
votes
1answer
19 views

Adding styles/scripts to specific page

I'm trying to add styles and scripts to specific template, But it's not working. In functions.php I tried: if( is_page_template('file.php') ){} if( is_page_template( get_template_directory() . 'file....
0
votes
0answers
90 views

enqueue style using admin-ajax.php

Actually I’m making a generic personnal template with customization from the backend; something like in the premium themes. So I made a “theme apearance options page” with ACF. I added fields like “...
0
votes
1answer
425 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', '...
0
votes
2answers
373 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 ...
0
votes
1answer
351 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: <...
0
votes
1answer
728 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
2answers
112 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
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 ...
0
votes
0answers
58 views

i can't handle any style or Js file on my theme . what is the problem of this file?

function elzero_add_styles(){ wp_enqueue_style('bootstrap-css', get_template_directory_uri() .'/css/bootstrap.min.css', array(), false, 'all' ); wp_enqueue_style('fontawesome-css', ...
0
votes
3answers
537 views

plugin enqueue style on all pages

I need to enqueue a style sheet in my plugin to work on the front end of Wordpress. Here is what I have. Will someone please tell me what I am doing wrong? function add_my_stylesheet1() { ...
0
votes
1answer
401 views

how to fix loading scripts in child theme?

I am trying to integrate an animation in my Wordpress home page, for this I am trying to load scripts from "skrollr" library, but my styles and scripts don't load. this is the code I added is ...
0
votes
3answers
180 views

wordpress doesnt add media.css file

I recognized that site is not responsive and media.css file is not working, i inspected with dev tools what kind of styles are included in header and i found that there is min version/css/media.min....
0
votes
4answers
1k views

Adding external stylesheet after ALL other styles

The theme I'm using makes extensive use of internal stylesheets to style various types of pages and their elements. For example, through their plugin UI, I can configure a specific page's hero layout ...
0
votes
1answer
184 views

How can I troubleshoot enqueue in general and loading Google fonts specifically?

I have this code straight out of one of default themes to load two Google fonts, except I changed the function name. The fonts are not loading, sans serif font shows instead. How do I troubleshoot ...
0
votes
2answers
752 views

javascript and css not loading properly in WordPress site

I managed to make my code working via codepen as you can see if you visit the link here Now trying to implement on a WordPress test site it looks like my javascript is not working as well as the ...
0
votes
0answers
205 views

Font Awesome not loaded on first page of website only - divi theme

I am new to WordPress and I created a WordPress website using DIVI theme, I have used font awesome on the website but unfortunately fonts are not loaded on first page of website only, I am getting 404 ...
0
votes
1answer
47 views

Javascript and Stylesheet in child page

I am trying figure out how to place JavasScript and stylesheet to parent page and children page via functions.php. The parent page is Our People and children page is staff names. This is what I wrote:...
0
votes
1answer
191 views

How to offload CSS and JS files from wp-content/themes folder?

Am using the WP Offload S3 plugin and not able to offload the CSS and JS files within the themes folder. Am trying to use wp_enqueue_style() like below in wp-content/themes/spark/functions.php ...
0
votes
1answer
66 views

How to check widget-cpt meta and display its custom css in the head?

When dealing with a widget that is a custom post type, is there a way to detect when that widget is displayed, then check its post meta for any custom css and enqueue it in the head of the site? ...
0
votes
1answer
126 views

How Can I Use A Child Theme Effectively When Parent's CSS Is Located in a 'CSS folder'?

I already have a child theme and a new style.css for it, but CSS changes in my child theme's style.css don't do anything because the parent theme's different CSS stylesheets come from a "CSS" folder. ...
0
votes
1answer
293 views

Customize the reset password page?

How can I style the reset password page, where I put in my new password? I tried going like this: function my_login_stylesheet() { wp_enqueue_style( 'custom-login', ...
0
votes
1answer
37 views

Should I be enqueueing styles/scripts once and then dequeueing them?

I'm new to WP dev and I want to add my own CSS/JS to an existing plugin via an extension that runs after the plugin has loaded (e.g. do_action('plugins_loaded')). This plugin did not have a payment ...
0
votes
0answers
128 views

List all non-admin enqueued files

I am using $wp_scripts and $wp_styles in my admin area to get a list of all css and js files on my site, but only admin registered styles and scripts are being added, I have googled and can't find a ...