All Questions
Tagged with css wp-enqueue-style
195 questions
1
vote
1
answer
634
views
Different ways to load child theme css
I've noticed that when I load the CSS for a child theme in the way shown here: https://digwp.com/2016/01/include-styles-child-theme/, I get double entries in the chrome inspector for my CSS rules, and ...
1
vote
1
answer
875
views
Parent theme CSS overriding child CSS rules
This seems like a common problem but as I modify my child themes style.css the parent style.css rules override any changes I make.
One of the main solutions seems to be to correctly enqueuing your ...
0
votes
1
answer
47
views
I want to set global directory locations for my CSS and JS locations. How?
I want some sort of variable to do what bloginfo( 'stylesheet_url' ) does.
Except in a different location!
Is there any way to set global directory locations?
Or am I stuck with copying the old ...
2
votes
1
answer
48
views
De-registering parent style sheet css recommended?
Just a general question: I am just wondering, why every tutorial for child themes still includes the parent's stylesheet. Would it not be preferable to de-enqueue & to de-register the parent's ...
1
vote
1
answer
42
views
Never Enqueued Stylehsheet
I never Enqueued the main stylesheet I'm using on my Wordpress site in the functions.php doc. I just uploaded the stylesheet to the site. Everything works, but I now want to dequeue the stylesheet on ...
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 ...
3
votes
2
answers
6k
views
How to force stylesheet to load before anything else in header?
I need a stylesheet to be added to the header before anything else. That means before any styles or scripts that are automatically added by any of the plugins I'm also using.
I figured I could add ...
0
votes
2
answers
4k
views
different style sheet for just one page template
I've been using site/page builders for so long in WP that I'm OOTL with the current setup of templates, stylesheets and functions in the newer WP builds.
I've got an older theme that I need to make a ...
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 ...
2
votes
2
answers
17k
views
I want to include my style.css in function.php file?
I'm new to WordPress. I'm including my file using
<link rel='stylesheet' href="<?php bloginfo("stylesheet_url")?>"/>
But if i enqueue my css file in functions.php it is not working. Why?
...
1
vote
2
answers
4k
views
Child Theme Not Overriding Parent Theme
I know this question has been asked many times. I even spent the entire day yesterday getting things to work but to no avail. I am pretty sure I am missing out on something small//silly but I am ...
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['...
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 ...
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' );
...
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 ...
2
votes
1
answer
4k
views
Understanding child theme functions.php
I have successfully created a child theme for the Emmet Lite template, using the information provided on here and here
The CSS file of the child theme looks like this:
/*
Theme name: Emmet Child
...
5
votes
3
answers
3k
views
how to include other plugins css files in a shortcode?
I've coded a plugin that creates a shortcode, among other things. That shortcode expects a post_id parameter, it extracts the content of that post and it returns the filtered content of that post (e.g....
0
votes
2
answers
916
views
Ideal inline dynamic CSS injection
There is a code in here that dynamically load custom script.
<?php
function my_styles_method() {
wp_enqueue_style(
'custom-style',
get_template_directory_uri() . '/css/...
6
votes
3
answers
38k
views
Give priority to child theme stylesheet
I've created a child theme and the main style.css works perfectly fine. However, the parent theme has another stylesheet which I want to import and create the same for child theme and use it instead.
...
2
votes
1
answer
2k
views
Enqueue style for Password Reset page
I've enqueued a style for my WordPress login page like so:
function login_stylesheet() {
wp_enqueue_style( 'custom-login', plugins_url( 'style-login.css', __FILE__ ) );
}
add_action( '...
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. ...
1
vote
2
answers
142
views
How do I load custom scripts and styles for a page?
Different pages often need different set of scripts and styles for them.
I use functions.php and construction like this to load scripts and styles:
function load_assets() {
wp_enqueue_style( '...
1
vote
3
answers
2k
views
Changes in enqueued / registered stylesheet paths not updating—why?
I'm attempting to modify a WordPress theme so that it appends a version number to a particular stylesheet. This is all done on a local development machine, tested on a staging server, too, for good ...
2
votes
2
answers
3k
views
Enqueued Stylesheets Effecting Admin Styles
I'm building a custom theme for a client and I've been adding stylesheets incorrectly for a while, so I decided to do it the correct way :-).
However, when I add the stylesheet to my functions.php ...
0
votes
2
answers
63
views
Faster fonts on mobile
I think I have a great idea to make my site load faster in mobile: "don't load the custom fonts in small screens"
I know how to style/change the font used depending on screen size with media queries ...
1
vote
1
answer
846
views
Which is the best way to incorporate custom fonts?
I believe there are 3 valid methods of incorporating custom fonts:
put a link to them in the header
enqueue them in functions.php
add them with @font-face in style.css
Which is the best way to do ...
2
votes
2
answers
607
views
Creating Admin Options Page where users can make changes to a theme
I need help to finish this last bit of php code. I'm trying to create an admin options page similar to in admin>settings>discussions like how a user can select an avatar, but instead of selecting an ...
2
votes
1
answer
1k
views
Adding inline styles from a widget
I'm working on a theme that has an optional widget to allow users to put some site elements where they want. One of those is a list of social media icons. These are font icons, so they can be styled ...
0
votes
1
answer
455
views
Controling css order
In my plugin I need to load css file after the standard style.css. I tried to do that with the priority paramter in the enqueue command but that works only if I modify the specificity of the classes(...
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 ...
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 ...
0
votes
1
answer
742
views
Custom Plugin - CSS works, JS doesn't
In the plugin I'm making, I use separate js and css files (____.js, ____.css). This is the first time that I've included an external .js file in anything.
I'm registering and enqueueing both in the ...
0
votes
1
answer
276
views
How do I get shortcode, widget and template tag CSS to load in the head only as required? [duplicate]
I have a shortcode, widget and template tag that need to load CSS. I am registering in init, and enqueueing as required.
The only problem is, it is adding the CSS loader at the bottom of the page, ...
5
votes
1
answer
9k
views
How to use wp_dequeue_style() for style enqueued in WP_Widget class
I've got a plugin that makes a widget that enqueues some front-end CSS to style the widdget. I call wp_enqueue_style from the public widget() method in the extended WP_Widget class:
<?php class ...
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 ...
0
votes
1
answer
1k
views
Enqueuing a stylesheet and ensuring it's loaded before (not after) the theme's stylesheet
In wp_enqueue_style()'s doc I see the third parameter is for stylesheets to be loaded before the one called by the function.
But is it possible to do the contrary, meaning to instruct WP to load a ...
2
votes
2
answers
2k
views
The correct way to include JavaScript and CSS in my WordPress Themes
I'm trying to build my own Wordpress theme using the correct ways. But...
The first trouble that I found was how to add css and js "using the correct way".
I found severals tutorials how to do it. e....
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....
1
vote
1
answer
2k
views
How to enqueue a random css style?
I want a random CSS style file to load on my site with each page view so I can play with colors backgrounds.
So I put all my styles in a folder, I named them 1.css, 2.css, etc. and I have added:
&...
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, ...
0
votes
2
answers
2k
views
Page Template Won't Load Correct CSS File
I can't get the correct css file to load for my page template. The page is correctly loading the template but still using the default css file.
This is the code I'm using to load the page template's ...
1
vote
1
answer
506
views
Disable child theme css on certain pages
I have activated child theme and would need to completely disable the child theme css on certain pages, leaving only the parent theme css.
How can this be done?
1
vote
1
answer
2k
views
Add external css to Contact Page
I am trying to add custom CSS to my contact form in wordpress which is a wp page which loads at mysite.com/contact. I don't want to edit any existing codes, I want to do this writing a simple plugin. (...
1
vote
1
answer
180
views
Theme Loading Into Dashboard
I'm having this really weird, never seen before, issue ... whenever I visit the Dashboard, after about 3-5 seconds, my theme loads into the Dashboard layout. It's like the theme's stylesheet is being ...
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" ...
3
votes
1
answer
293
views
Is it possible to change the path of a css file that is registered through wp_enqueue_style()?
The theme I am using already calls the wp_enqueue_style function to enqueue a css file.
I want to whether it is possible to change the css file path before it is actually outputted on the page.
Why ...
0
votes
1
answer
1k
views
wp add inline style in loop
I want to add inline styles thanks to the wp_add_inline_style wordpress function.
The inline styles will be added in a loop.
In my case, I output an isotope grid in my loop and this grid can have ...
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 (...
0
votes
2
answers
943
views
is there a way to get all queued scripts/styles into a template without `get_header()`?
in my main plugin page i check if a certain page is visited if so, i load a certain template. in the following way:
add_filter( 'template_include', array($this, 'includeTemplate'), 99 );
public ...
0
votes
2
answers
140
views
Some questions about how proper add 2 CSS file in a WordPress theme?
I have the following situation loading a CSS.
I have a WordPress theme that load a style.css settings file by this code into my functions.php file:
/* Function automatically executed by the hook:
* ...