Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
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' ); }); ...
fuxia's user avatar
  • 107k
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['...
Edouard Kombo's user avatar
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('...
Pipo's user avatar
  • 609
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 ...
vonholmes's user avatar
  • 159
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 ...
redconservatory's user avatar
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/...
its_me's user avatar
  • 4,512
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 ...
Padraic's user avatar
  • 93
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 ...
cjbj's user avatar
  • 15k
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( '...
Boykodev's user avatar
  • 337
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 ...
Dustin's user avatar
  • 374
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 ...
byronyasgur's user avatar
  • 3,032
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 ...
Evan Mattson's user avatar
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 $...
kaiser's user avatar
  • 50.8k
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....
forrest's user avatar
  • 483
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 ...
Toniq's user avatar
  • 447
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. ...
nimsrules's user avatar
  • 208
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 ...
mrwweb's user avatar
  • 10.3k
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....
Lucio Crusca's user avatar
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' ); ...
Anna Oleksiuk's user avatar
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()); ...
DVDSON's user avatar
  • 23
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 ...
newbie1985's user avatar
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" ...
Greeso's user avatar
  • 2,204
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( '...
Laxmidi's user avatar
  • 971
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?
user1049961's user avatar
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