All Questions
Tagged with css wp-enqueue-style
25 questions
10
votes
1
answer
6k
views
Enqueue a stylesheet for login page and make it appear in head element
I try to style the login page in my theme. Very simple:
add_action( 'login_enqueue_scripts', function()
{
wp_enqueue_style( 'TEST', get_template_directory_uri() . '/css/login.css' );
});
...
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['...
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('...
10
votes
1
answer
21k
views
How to enqueue style before style.css
How do I enqueue a .css file before style.css is loaded? Or make the default style.css dependant on another .css file?
I'm trying to load a .css reset, which style.css would overwrite.
Here's what I ...
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 ...
11
votes
4
answers
7k
views
Enqueue Google Web Fonts Without Messing Up Symbols In URL
Enqueuing Google Web Fonts the usual way, i.e., using the wp_enqueue_style function like so...
function wpse_google_webfonts() {
wp_enqueue_style( 'google-webfonts', 'http://fonts.googleapis.com/...
9
votes
8
answers
15k
views
How to add stylesheets only to pages with specific shortcode?
I'm running a function on pages where the shortcode [make-me-a-map] is used. It enqueues javascript to the page and makes a map. That part works fine (woot!) but I'm having trouble with adding the ...
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 ...
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( '...
22
votes
2
answers
1k
views
Is it ever okay to include inline CSS in plugins?
Normally in a plugin I would add styles using wp_enqueue_style. However, I am currently creating a plugin that only needs a few lines of CSS and I am wondering if it might be better to serve the ...
20
votes
3
answers
4k
views
How important is it to enqueue a theme's stylesheet?
I have trawled the net looking for an answer to this, but for some reason all I can find are actual examples, but without that particular explanation, which is clear say in the case of scripts. Can ...
11
votes
3
answers
22k
views
How to conditionally enqueue a stylesheet only for a certain page(s)?
Before I get started, I want to acknowledge that there are some really good articles that are targeted at how to conditionally enqueue scripts based on page/post content.
WordPress Plugin Development ...
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 $...
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....
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 ...
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.
...
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 ...
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....
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' );
...
2
votes
3
answers
2k
views
"wp_enqueue_style();" don't load new edited style
First, sorry my english. I am using Local by flywheel to manager my site files and my wordpress version is 4.9.4.
Here is the problem, When I use
wp_enqueue_style('wharever', get_stylesheet_uri());
...
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 ...
1
vote
3
answers
318
views
To enqueue or not to enqueue
What is the best way to link to a CSS file in WordPress?
Method 1: Use the following whenever needed
<link href="<?php echo get_template_directory_uri(); ?>/my-style.css" rel="stylesheet" ...
1
vote
1
answer
3k
views
wp_enqueue_style in Plugin [duplicate]
Possible Duplicate:
Where is the right place to register/enqueue scripts & styles
When I enqueue a css style in a plugin like so:
function add_my_stylesheet()
{
wp_enqueue_style( '...
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?
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. ...