All Questions
Tagged with css wp-enqueue-style
195 questions
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
/*
* ...
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
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
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() ...
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
0
votes
1
answer
116
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 ...
-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
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?
...
1
vote
0
answers
189
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-...
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
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, ...
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() {
...
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 ...
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 ...
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/...
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) ...
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 ...
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 ...
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
*
* @...
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 ...
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());
}
...
0
votes
1
answer
197
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-...
1
vote
1
answer
580
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....
1
vote
1
answer
786
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
1
answer
153
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 ...
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 — ...
0
votes
2
answers
2k
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
1
answer
41
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
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....
0
votes
1
answer
322
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
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( '...
0
votes
1
answer
718
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
3
answers
7k
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
1
answer
4k
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
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 '...
20
votes
2
answers
13k
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('...
1
vote
1
answer
3k
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 ...
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;
...