We’re rewarding the question askers & reputations are being recalculated! Read more.

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
46 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
21 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
23 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
19 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
18 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
21 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
24 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
50 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
70 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
73 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
97 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
24 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
18 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
22 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
165 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
164 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
35 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
40 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
22 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
37 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
50 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
25 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
122 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
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
49 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
214 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 ...
4
votes
2answers
764 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
118 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
358 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
547 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 ...
0
votes
3answers
742 views

Load CSS in footer, like your can with JS?

I'm loading some third party CSS with the help of wp_enqueue_style. I would like this CSS to be loaded in the footer, so it does not block rendering of the page. This would be fine, since this CSS is ...
0
votes
1answer
75 views

Un-enqueue styles for certain built-in Gutenberg block types?

Is it possible to un-enqueue stylesheets for the built-in Gutenberg block types? e.g. I would like to add custom styles for the Gutenberg Columns block, so I'd like to un-enqueue the stylesheets just ...
0
votes
1answer
156 views

Homepage not loading correctly, but then loads when refreshing

When going to our homepage (www.whiteskitchen.co.uk). We seem to have lost the styling on the homepage. I checked the source code and it’s not fully loading the page. When you refresh the page or ...
0
votes
0answers
463 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
2answers
75 views

How should I identify the inline javascript that is the dependent of a wp_enqueue_script?

I want to run my own JavaScript on a specific WordPress page but only after a third party's plugin runs as I am trying to slightly modify that plugin. My problem is that my JavaScript is running ...
4
votes
1answer
577 views

Get the list of enqueued/registered scripts for a specific post?

I am exploring how to build a theme where most of the pages are loaded using the Rest API. I can load the index page and from there make GET requests to get posts json data and after build its content ...
0
votes
1answer
34 views

how to load css and js based on post template

I have created a post having the following template: <?php /* Template Name: Html Code Template Post Type: post, page */ ?> <?php get_header(); ?> <?php get_sidebar(); ?> <div id=...
0
votes
3answers
71 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
26 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 '...
10
votes
2answers
3k views

How to add crossorigin and integrity to wp_register_style? (Font Awesome 5)

I am upgrading Font Awesome 4 to version 5 which introduces both integrity and crossorigin attributes to the <link rel="stylesheet"> markup. Currently, I am using: wp_register_style('...
0
votes
1answer
482 views

Stylesheet Enqueue Order and Best Practices

i would like to do the following: customize a theme to my likings for use on several sites and installations. so i can make "global" changes (via own plugin?) then i would like to have a site ...
1
vote
1answer
2k views

Override load-styles.php with admin screen css

I am trying to modify css. I tried to modify the css with below code but does seems to work. if i try to change the color it works. #poststuff #post-body.columns-2 { margin-right: 300px; ...
0
votes
1answer
23 views

Page Templates not using functions.php

I am having an issue with page templates in Wordpress. I have created some for my website but they are not using the wp_enqueue_style in my functions.php. anybody know why this is? mainly my ...
0
votes
1answer
20 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
92 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
3answers
628 views

Apply function only if end of url has /amp/

I applied a filter to remove all theme styles, but I want this to happen only if the url ends with /amp/. The code below is removing the .css styles on all pages, not filtering the term /amp/ of the ...
4
votes
2answers
448 views

Why my CSS file is not being registered in functions.php? [closed]

I want to enqueue the stylesheet in functions.php, but it's not loading. What can be problem in my code? function my_theme_sty() { wp_enqueue_style( 'bootstrap', get_template_directory_uri().'/...
0
votes
1answer
143 views

CSS getting injected into index from somewhere after theme/custom CSS is loaded, overriding all of my CSS [closed]

Using the inspector tool i can see that some CSS is getting injected/generated from somewhere (which i don't know where) which is overriding my own css. I've tried several things from using a child ...