Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
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 /* * ...
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/...
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 — ...
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', '...
0 votes
2 answers
187 views

Split Media Queries in different files!

I woke up this morning with a thought. Is it a good idea to split the different media queries in different files, check the width of the page in functions.php and then with an IF call the "correct" ...
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 ...
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 ...
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: ...
2 votes
1 answer
2k views

Enqueue styles in new site editor in WordPress 5.9

In the block editor for posts and pages, I used to use the enqueue_block_editor_assets hook to enqueue styles for the block. add_action( 'enqueue_block_editor_assets','load_assets_in_block' ); ...
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 ...
0 votes
2 answers
473 views

How enqueue CSS out of theme folder?

How we can enqueue a stylesheet out of theme folder? Example: wp-content > cssfile.css
2 votes
2 answers
8k 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
1 answer
89 views

wp_head not injecting css

I'm trying to inject a style.css script into my front-page.php. None of the styles load. In the tutorials, when you inspect page source, all the CSS should be there, but it simply shows the wp_head() ...
-1 votes
1 answer
218 views

Custom theme – Bootstrap CSS not loading via wp_enqueue_style or otherwise

I'm designing a custom Theme using the underscores.me template. I've read several different "my css doesn't load" articles on this topic, but none seem to help w/ my issue. My own styles ...
0 votes
1 answer
117 views

plugin not loading my css and js

Hi I'm using the standard way to load styles and scripts within my plugin. But I have no clue why it's not working. It's not shown in the network tab nor in the <head>. Can this cause issues ...
0 votes
1 answer
272 views

Enqueue MCE Editor CSS in admin page

I am using mce editor for some formatted content. That content is stored in metadata. Now when I render the content it does render the content but the styles for the contents are missing like "...
0 votes
1 answer
324 views

How to add/enqueue Custom CSS for a custom taxonomy page?

So this is what I have done for my homepage so I load css that only loads on my homepage function enqueue_frontend_assets(){ if(is_page_template( 'homepage.php')) { wp_enqueue_style( '...
0 votes
1 answer
62 views

str_replace inside specific css files [closed]

Is it possible to perform str_replace inside an enqueue stylesheet? i can do str_replace on inline style with this function function replace_text($text) { $text = str_replace('background-image', '...
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? ...
11 votes
4 answers
33k views

Why is style.css not being enqueued?

I got a pretty basic theme and just found out my style.css file doesn't get loaded into the <head>. I already searched around but can't find out, why it's not loading. I inspected the global $...
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 ...
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-...
14 votes
3 answers
24k views

Wordpress admin stylesheet

Is there a way to override the styles in the admin in my theme? I don't want to touch the admin style sheet if I don't have to. I just want to make a column bigger in my admin, but also, to do it in ...
0 votes
1 answer
35 views

Why would the child theme load in the Customize preview, but not on the site itself?

I have my child theme folder, the style.css sheet with the required template comment and some custom css, and I have the functions.php page with the required enqueing code. Everything seems to be in ...
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, ...
1 vote
1 answer
2k 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 ...
23 votes
5 answers
42k views

How can I get a list of all enqueued scripts and styles?

I'm creating a plugin and I want to get the list of all scripts and CSS used by other plugins. This is my function: function crunchify_print_scripts_styles() { $result = []; $result['...
4 votes
2 answers
11k views

How can I dequeue a Plugin Stylesheet?

I am currently using a Plugin, which has created a Stylesheet within the following directory: /wp-content/uploads/plugin-name/css. I would like to remove this Plugin's Stylesheet, since it is being ...
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() { ...
5 votes
2 answers
4k views

Use wp_enqueue_scripts, not wp_print_styles?

Everywhere is said that you need to use wp_enqueue_scripts() instead of wp_print_styles(). wp_print_styles() is located in wp-includes/functions.wp-styles.php. So what does it mean? What should I ...
0 votes
1 answer
25 views

theme style is applied on the dhasboard rather than the website

I am creating a new theme, I created a new directory called mytheme and created three files directly inside the directory where the content is as follow: index.php <?php echo "hellow world&...
0 votes
2 answers
212 views

Which is the correct way to conditionally enqueue a CSS file?

get_queried_object returns NULL inside a function hooked to wp_enqueue_scripts action hook when going to an nonexistent category URL on my website. If the category exists, the error is not shown and I ...
0 votes
1 answer
522 views

How to add CSS via custom plugin?

I am making my first plugin. I create a folder in \wp-content\plugins, create a test.css and a test.php file. Here is my test.css: body { background-color: red !important; } Here is my test.php (...
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 ...
4 votes
3 answers
13k views

How to add extra attribute to stylesheet link?

Following Keith Clarks advice, i'd like to load my fonts asynchronously. I try to achieve that by adding: wp_enqueue_style( 'font-awesome', URI . '/fonts/font-awesome/css/font-awesome.min.css' ); ...
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' ); ...
0 votes
1 answer
114 views

My CSS suddenly doesn't load anymore [closed]

I've did some small changes on my CSS, nothing crazy, uploaded them to my website. Cleared my cache and suddenly, the website doesn't show my custom styles. Website: http://experienceantwerp.be/ My ...
1 vote
4 answers
5k 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
2 answers
2k views

I can't add CSS with functions.php

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
1 answer
60 views

Dequeing Parent Fontawesome Deques Parent Styles

I'm trying to dequeue fontawesome from a parent theme in my child theme. For this I use the following code: function si_dequeue_child_styles() { wp_dequeue_style('wp-bootstrap-starter-fontawesome-...
0 votes
1 answer
921 views

How can I force Dynamic CSS via ACF values to update on page load?

I'm trying to dynamically change the background color of a post on scroll to colors set in post options via an ACF color picker. I was able to source enough code examples to get it working (I thought) ...
8 votes
3 answers
39k views

What is the correct way to enqueue multiple CSS files?

I am building a Bootstrap site on WordPress and need to be able include multiple stylesheets. However, when I enqueue them as follows, only the first and third style sheets show up in the page source....
5 votes
4 answers
2k views

Is it possible to enqueue a raw CSS string directly from within a template file?

I was wondering if it's possible to enqueue raw CSS as a string directly from within a template file? I'm writing a custom template for a page and need to add some style rules for it. What I want to ...
13 votes
2 answers
22k views

How to load scripts/styles specific for a page

I know that according default Wordpress boot process, firstly functions.php is called, after that goes all theme stuff. But I am currently going to refactor my theme completely to optimize it. My ...
1 vote
1 answer
2k views

Use wp_add_inline_style to add code to before wp_head?

I’m building a Wordpress theme for Themeforest. In the customizer I’ve given users the ability to also use the rem unit for their font sizes. I’ve created three different settings that control the ...
7 votes
2 answers
7k views

Remove wp_add_inline_style

Is there a way to remove styles added with wp_add_inline_style? I noticed if I call wp_add_inline_style multiple times, it just keeps adding style, it does not overwrite what was added before. The ...
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 ...
3 votes
1 answer
685 views

Why isn't my theme processing SASS?

It's my understanding that Wordpress now processes SASS files but for some reason mine don't work. I'm trying to call it using wp_enqueue_style directly in header.php via the head tag: <?php ...
0 votes
2 answers
259 views

Browser stacks different versions of style.css

I am working with a child theme from 'Astra'. I am editing 'style.css' of my child theme for styling my website. I added this code to my child's functions.php' file to enqueue the father-child styles. ...
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 * * @...