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
0answers
16 views

style.css not loading in child theme name Blabber [closed]

Style.css not working on live server. It was working on local server. I am using wordpress paid theme name blabber.
0
votes
1answer
19 views

Bootstrap Integtration

I wonder how can I integrate only bootstrap 4 grid system instead of : <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-...
0
votes
1answer
17 views

Stylesheets and scripts not loading

function spartans_styles(){ wp_enqueue_style( 'maincss', get_stylesheet_uri()); wp_enqueue_style('mybootstrap', get_template_directory_uri() . '/assets/css/mybootstrap.css'); ...
0
votes
1answer
86 views

Fatal error: Uncaught Error: Class 'WP_Block_Styles_Registry'

I am having some issues determining the solution to this problem below. The website was sent to our team to fix. Turned on error reporting in wp-config.php: define('WP_DEBUG', true); ...
-1
votes
2answers
22 views

How to only Load scripts on variable products page

I'm looking for a way to load my JavaScript and CSS only on the product page, but only if it's a Variable Products. The is_product() function works well, but my scripts are loaded for all types of ...
0
votes
1answer
19 views

Call a single function on two different methods with hooks

So I'm wanting to shorten my code down a bit and I would like some assistance.. How can I shorten the following methods into a single register method? They both have add_action which is a WordPress ...
0
votes
3answers
50 views

Enqueue custom css file on specific page

So I've been messing with this for a while now and I don't understand how I'm unable to pull in my style file properly by registering and calling it at all. Here is my method: public static function ...
0
votes
1answer
25 views

Bootstrap 4 Optimization

I installed all bootstrap links to my theme.I use bootstrap lowly; generally for grid system.How can I learn which link do I must install or not? Also I want to learn is my installation good or is ...
0
votes
1answer
34 views

Dequeue a style file which is making website load slow!

I have a website running on GrandNews WordPress Theme (https://themeforest.net/item/grand-news-news-magazine/15885465) and loading via KeyCDN. The site is loading a CSS file located at websitedomain....
0
votes
1answer
43 views

PHP Notice: wp_enqueue_script was called incorrectly. Scripts and styles should not be registered

Can someone help me fix this error? PHP Notice: wp_enqueue_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, ...
0
votes
1answer
9 views

How do I dequeue js/css at the last possible moment?

I'm trying to dequeue the font-awesome stylesheet included with the ninja forms plugin (because I manually include the latest FA via a CDN). I did this: add_action('wp_enqueue_scripts', function () {...
1
vote
2answers
39 views

Child theme style.css versioning

I've been breaking my head on this one. I have a child theme and made changes to the style.css document. These changes did not show up in the reload of the page because there is no mention of version ...
1
vote
1answer
25 views

why enqueued styles in header.php shows in footer?

I`m using this code in functions.php: add_action('wp_head', 'addMyStyle'); function addMyStyle() { wp_enqueue_style( 'bootstrap', get_template_directory_uri() . '/css/bootstrap.css', false, '1.0',...
0
votes
1answer
19 views

Plugin and themes are adding the same stylesheets

/vendors/font-awesome/font-awesome.min.css? ver=2.9.10 /yith-woocommerce-wishlist/assets/css/font-awesome.min.css? ver=4.7.0 /theme/css/font-awesome.min.css **this csss are from different ...
0
votes
1answer
435 views

Enqueue custom font file with rel=“preload”

I'm using a custom font on my WP site. It is now included with @font-face css attribute. But I'm wondering if there is any way to wp_enqueue this file with the attribute rel="preload" and may be some ...
1
vote
2answers
46 views

Deregistering a script in Wordpress seems impossible

I tried everything. I even removed all content in functions.php and created a whole new file with just this: function wpdocs_dequeue_script() { if (is_singular()) { wp_dequeue_script( 'gdrts-...
0
votes
0answers
42 views

Why can I not deregister my style and script on custom post type?

I have a website where I have a custom post type with some single pages attached to it. Problem: I can't deregister the scripts and styles on my custom post type single pages. This is my code: ...
1
vote
1answer
45 views

How to organize priority of plugins CSS files?

I'm developing website with theme (Astra Pro with child theme) and plugins. While I'm checking my performance in Chrome Dev Tools trace shows non-critical stylesheets with high priority. Example — ...
0
votes
1answer
62 views

How to remove all enqueued assets from the active theme?

https://gelwp.com/articles/removing-all-enqueued-and-default-css-scripts-in-wordpress/ has code that removes all the enqueued styles including those that may be coming from other plugins besides the ...
0
votes
1answer
33 views

How to make the RTL.css the dominant css code?

I have a multilingual website, English (default) and Arabic, and also a parent theme and a child one. Now, I want to load the CSS on this order: In English: Parent Style.css then Child Style.css In ...
2
votes
1answer
37 views

Style reset password page? /wp-login.php?action=rp

I cannot figure out how to style the reset password page. And I do not mean the page where you request it, I mean the page you are shown when you click the link in the email to set your new password. ...
0
votes
1answer
20 views

Are there any caveats to compiling all of my theme's SCSS into the style.css file in the theme root?

I work in WordPress development and I've always been told by more seasoned WP devs to compile my theme SCSS into a separate style.css file, typically into a sub-directory like assets/css/style.css. ...
0
votes
1answer
20 views

Enqueued stylesheet appends query string, causing “SyntaxError: Invalid or unexpected token”

function renderProductPageUi() { wp_enqueue_style('stylesheetHandle', plugins_url('pluginName/semantic/dist/semantic.css')); require_once ('templates/offerBox.php'); } add_action('...
0
votes
0answers
38 views

Load script and styles using an array of resources

I want to simplify the scripts and the stylesheet loading in my wordpress plugin. I have this code style now, but I want to implement a best solution, this to encache the function readbility. Is there ...
1
vote
1answer
26 views

How to remove style and js from theme and add your own style and js where shortcode is used?

I making a small plugin for wordpress and that works through a shortcode. is it possible that the page that uses my shortcode has only my js and style rather than having theme style and js as well. I ...
0
votes
1answer
14 views

How do I ensure I can loop through every enqueued script and CSS?

I'm on a bit of an efficiency drive. To this end, I would like to check all the scripts and CSS that get enqueued on my multisite setup. I plan to check that they are offloaded to public CDNs if ...
0
votes
1answer
114 views

Dequeue Scripts and Style for Mobile not working?

I've followed a few tutorials on Dequeueing and Deregistering scripts and styles for WP - trying to optimise my site speed. Initially I could dequeue and deregister, until I added a condition for ...
0
votes
2answers
173 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
2answers
194 views

Move dashicons.min.css to Footer

Hey there WordPress community, Google page speed is moaning about dashicons.min.css being on our site. However, we need it for the Mega menu. I wanted to know if it's possible to move it to the ...
1
vote
3answers
379 views

How to dequeue / deregister any theme styles and scripts

Is it possible to some how make my plugin dequeue / deregister any styles and any scripts from what ever theme activated. so it doesn't matter what theme will be installed the styles and scripts of ...
0
votes
0answers
31 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
1answer
22 views

Set different css stylesheet for specific pages [duplicate]

Is it possible to assign a css stylesheet to specific pages only? If so how? Can I use something like this? Not sure how to specify the pages though? add_action( 'wp_enqueue_scripts', '...
0
votes
0answers
25 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,...
1
vote
2answers
272 views

is_page() function doesnt working

I'm trying to add these custom CSS and JS (written inside a custom plugin) only add to a specific page. this is my code <?php function randomAlphaNumeric($length) { $pool = array_merge(...
0
votes
1answer
300 views

Enqueue script with version number not working

I am trying to enqueue a script for a custom plugin and I want to include a version number for cache busting. However, the ?ver= query is not being appended to the script name in the html and ...
0
votes
0answers
41 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
1answer
57 views

How to NOT override inline css rules

I had to dequeue the style.css parent theme file and requeued a copy without the @media rule for the menu from my child folder with a priority of 11. But now this new style is overriding inline rules....
0
votes
1answer
28 views

wp_enqueue_style on template_redirect level?

I am using the following function, which works fine, in order to provide a minimal output of HTML at a WordPress installation of mine: add_action( 'template_redirect', 'test' ); function test() { ?&...
0
votes
0answers
20 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
43 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
53 views

My Child Theme CSS Isn't Working

I have a child theme of the twenty seventeen theme. The problem i'm having is that my child theme css isn't working. I have checked the page source and the css file for my child theme is loading but ...
0
votes
1answer
33 views

Why is Wordpress enqueuing admin relevant scripts (e.g., React, ReactDOM, Redux, hooks, TinyMCE etc) when not logged in?

In attempting to boost the performance of my website, I've noticed that Wordpress is enqueuing a lot of the admin relevant scripts and stylesheets on the front end. I'm wondering how I can stop this ...
0
votes
3answers
228 views

How to link style.css in functions.php

I'm a newbie to WordPress; I just started learning WordPress. I'm trying to link style.css in functions.php but I am unable to achieve what might be the issue here. Can anyone point me the right ...
0
votes
1answer
15 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
72 views

Append style tag in head while shortcode runs

I have a plugin with shortcode. Shortcode returns some html in page. I will have some dynamically generated css that I want to place in the page as well. I tried using wp_add_inline_style (to hook to ...
0
votes
1answer
303 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 ...
5
votes
2answers
1k views

Load CSS/Javascript in frontend conditionally if block is used

Assuming I have no infinite scroll or anything else going on in my theme: Is there a way to enqueue my custom Gutenberg block styles and scripts so they are only (lazy) loaded in the front-end when ...
0
votes
1answer
252 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
674 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. ...
1
vote
0answers
722 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 2 3 4 5 10