Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

2
votes
2answers
41 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
26 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
26 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
63 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
85 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
23 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
29 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
110 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
43 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
313 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
24 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
68 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
16 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 '...
6
votes
2answers
732 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
32 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
526 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
21 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
18 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
32 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
214 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
104 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
79 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 ...
5
votes
2answers
363 views

Removing specific style from wp_head

I'm not a WordPress developer, I'm trying to help a friend who has a WordPress website. Here is the problem: In the template, wp_head() function adds bunch of styles and scripts. I want to remove ...
2
votes
1answer
33 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 ...
1
vote
0answers
465 views

Font Awesome 5 Free - far working but fas is not? [closed]

This is making me crazy. I'm using Font Awesome 5 Free in custom list styles using :before and content: In every instance, far icons are working and fas icons are not. I've checked everything I ...
1
vote
2answers
32 views

CSS not affecting widget output

so I am still quite new to wordpress development so don't rage and I am sorry if I did something really stupid. So I am having trouble with my CSS, for some reason it's not affecting the widget ...
0
votes
2answers
328 views

How to change menu labels

What is the best approach to changing admin menu labels? As part of my first step in modifying the admin area, I would like to know how I can change WooCommerce label to Shop?
0
votes
2answers
27 views

Enqueueing styles with version variable

My version variable doesn't seem to be being applied within my enqueue functions (snippet below). //version number $version = '1.0.0'; function frontend_styles($version) { wp_enqueue_style( ...
0
votes
1answer
141 views

Using wp_add_inline_style Inside a Template File

I'm trying to figure out how to get wp_add_inline_style to work inside a template file. The code I'm using is this: function custom_css() { $output = '.some-class { background: #000; }'; ...
0
votes
1answer
29 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
23 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
155 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
35 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
254 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
165 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
0answers
20 views

How to load the style.css to my index.php?

I'm having a lot of trouble trying to add the style.css to a new WordPress theme I'm making (name "vik01"). I've tried different instructions, following some tutorials, but in the end nothing seems ...
0
votes
1answer
140 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
25 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
84 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
0answers
280 views

Child theme: wp_enqueue_style doesn't load parent style.css

I try to create a Portal child theme, as I did already for some other theme, but wp_enqueue_style method do not load the parent style.css. Here is what I did : I created a folder named portal-child ...
0
votes
1answer
272 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
48 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
271 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
51 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
58 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
245 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
0answers
95 views

Error importing Bootstrap with wp_register_style

I'm trying to import the Bootstrap library in my Wordpress website. I have downloaded it from the website and I have copied the files into the css folder inside my theme folder. Here is the code: ...
0
votes
1answer
211 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
183 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
219 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: <...