Skip to main content

All Questions

Tagged with
36 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
3 votes
3 answers
3k 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', '...
Troy Templeman's user avatar
3 votes
2 answers
547 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 ...
SelketDaly's user avatar
2 votes
1 answer
243 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 ...
scopeak's user avatar
  • 213
1 vote
0 answers
60 views

Load RTL CSS using block.json for block development

I am developing a block using block.json and I could load RTL CSS on backend using this code: // Check if RTL mode is enabled if (wp.i18n.isRTL()) { // Import RTL stylesheet if RTL mode is enabled ...
Farhad Sakhaei's user avatar
1 vote
0 answers
223 views

How to override Bootstrap css with my child theme css in wordpress?

I am trying to load my site's child theme's css after Bootstrap CDN css in wordpress. I tried using these code but it doesn't work. The Bootstrap css is not overriden. What should I do to fix that? ...
wcwc's user avatar
  • 11
1 vote
0 answers
190 views

Load CSS before Theme CSS

I have a stylesheet I want to load first in the head before other plugins load css or theme css. For some reason priority is not working for me. Any idea how I can achieve this? I need to use ...
Ads's user avatar
  • 11
1 vote
0 answers
136 views

How to check if a WordPress core block is active in sidebar

I have a widget area and I want to enqueue a stylesheet only if a core block is active in it. I tried the following code: // if has audio block. if (has_block('audio')) { wp_enqueue_style('audio-...
Zeddy Emy's user avatar
1 vote
1 answer
3k 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 — ...
Stewart Wallace's user avatar
1 vote
0 answers
133 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-...
Run's user avatar
  • 331
1 vote
1 answer
406 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 ...
user3415011's user avatar
1 vote
0 answers
3k 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 ...
Riffaz Starr's user avatar
1 vote
0 answers
130 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 (...
Greeso's user avatar
  • 2,204
0 votes
0 answers
7 views

Twenty Twenty Four child theme stylesheet is not being enqueued in admin panel when editing pages

I have created a child theme of Twenty Twenty four. I have a styles.css in the child theme directory and I have enqueued the stylesheet to load in the child theme's functions.php: <?php /* * ...
Jason's user avatar
  • 691
0 votes
1 answer
627 views

Enqueue Stylesheet on the front end and in the block editor Conditionally

How would you include a stylesheet in both the block-editor and on the front-end if the page meets certain criteria? In this case I want to include a stylesheet called homepage.css if the page is the ...
Walrus's user avatar
  • 131
0 votes
0 answers
26 views

Styling best practices for single pages/templates

What's the best practice for CSS that is specific to one PHP file? For example, let's say I make a page page-456.php that is styled differently from the rest of the site, what's the best practice to ...
Coopero's user avatar
  • 101
0 votes
0 answers
248 views

Advanced method to control cache of enqueued style/script

I have a WordPress website with medium-level traffic, ~10,000 unique visitors a day. Arround 30% of my daily visitors are recurrent. I constantly make some UI improvements: colors, font-size, ...
Alexandro Giles's user avatar
0 votes
1 answer
299 views

Dequeue styles with query doesn't work

In my theme there is the following code (that is printing some inline css on the head of my site) final class Design_Scheme { /** * Design_Scheme constructor. */ private function __construct() { ...
Honoluluman's user avatar
0 votes
0 answers
138 views

Save custom option in CSS file

I have built this script in order to display a CodeMirror in a plugin and through the CodeMirror integration I can inject and save CSS in the head of the website, the result is very cool but I would ...
Marcello Perri's user avatar
0 votes
0 answers
32 views

Problem with displaying CSS Stylesheets - Am I adding them correctly in my wordpress child theme?

Is this a proper way to load CSS files into my WordPress child theme? add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' ); add_action( 'wp_enqueue_scripts', 'case_studies_styles' ); ...
JohnDem's user avatar
0 votes
1 answer
1k views

How to enqueue stylesheets in child-theme functions.php?

I know this topic is old hat, but I still got issues with that. I use the elementor child-theme and try to enqueue the following stylesheets hello-child-theme-folder: style.css hello-child-theme/...
Chrizzly's user avatar
0 votes
0 answers
53 views

How to reference different css (bootstrap) stylesheets for the header and body of a page?

Thanks in advance for the help, and apologies if I'm being dumb, I'm rather new. I have tried various different answers on this site, but they did not work, as they were meant for different pages. I ...
Vanessa Chen's user avatar
0 votes
0 answers
262 views

Add inline CSS to login page with wp_add_inline_style

Trying to add inline style with wp_add_inline_style to login page by targeting login-css style sheet.. add_action( 'login_enqueue_scripts', 'bt_css_login', 1009 ); /** * Enqueue Login CSS * * @...
neilgee's user avatar
  • 163
0 votes
0 answers
40 views

CSS style and app.js not loading

I'm brand new at theme development. My directory is the following: I should see, in the page source (even if I have a blank page) the app.js loaded, but I don't. This is what I see: what is wrong in ...
Giacomo Ialenti's user avatar
0 votes
1 answer
66 views

Stylesheet does not load despite functions.php

I am calling my stylesheet styles.css within functions.php. Also adding add_action. But it does not work… <?php function myBlog_files() { wp_enqueue_style('styles', get_stylesheet_uri()); } ...
S.H's user avatar
  • 105
0 votes
1 answer
36 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( '...
Pragman's user avatar
  • 111
0 votes
1 answer
43 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 '...
Madhur Jain's user avatar
0 votes
1 answer
668 views

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: ...
Rowan's user avatar
  • 1
0 votes
2 answers
130 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 ...
Stefka Waaijer's user avatar
0 votes
3 answers
267 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....
Andrew's user avatar
  • 135
0 votes
1 answer
202 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. ...
PercentSharp's user avatar
0 votes
1 answer
174 views

Modify arguments for parent theme's `wp_register_style` via child theme

Working on a child theme for site with a good deal of separate stylesheets being registered/enqueued from the theme and plugins. I'd like to change some attributes of the <link> tags in the ...
shender's user avatar
  • 101
0 votes
0 answers
286 views

Why are my parent styles loading after my child styles?

I am trying to build a child theme that uses SCSS. However, every time I make changes and recompile my stylesheet, it gets overridden by the parent stylesheet. This is because, in the head of my site, ...
mcography's user avatar
  • 363
0 votes
0 answers
125 views

Replacing parent theme's IE-specific CSS

I'm trying to do exactly what was apparently achieved in this discussion. However, I'm finding that my IE-specific stylesheet's being loaded all the time! My parent theme includes this in its ...
Adam Abrams's user avatar
0 votes
1 answer
416 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....
Andrea's user avatar
  • 1
0 votes
1 answer
2k 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 ...
Craig's user avatar
  • 358
-2 votes
2 answers
319 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 ...
Dev_John's user avatar