A safe way to add/enqueue a CSS style file to the wordpress generated page. If it was first registered with wp_register_style() it can now be added using its handle.

learn more… | top users | synonyms

1
vote
0answers
14 views

iris color picker in widget - click event doesn't fire when initially when widget is first created

I added the wordpress(iris) color picker to a widget, and the color picker is not clickable when the widget is first created. My guess is that it's where/how the javascript file is being enqueued, but ...
0
votes
1answer
22 views

How to add conditionals for IE browsers between certain versions?

I know that wp_script_add_data and wp_style_add_data are the correct functions for adding IE conditionals. For example, this: wp_script_add_data( 'foo', 'conditional', 'lt IE 9' ); Would get you ...
0
votes
1answer
49 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
1answer
27 views

enqueue_parent_style

I am trying to change my @import style.css to wp_enqueue_style for my child themes. I added the following into my functions.php child theme and it returns a 500 error. I looked at this and pretty much ...
2
votes
1answer
76 views

Remove specific CSS and JS from the head

I'm trying to remove some specific lines from the WP_HEAD. Now my header looks following way: <link rel='stylesheet' id='bootstrap-css' href='/themes/wp-e/css/bootstrap.css?ver=4.2.2' ...
0
votes
1answer
117 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
1answer
30 views

Why wp_enqueue_style() is adding CSS class?

Why my stylesheet links are getting -css at the end? How can I remove that ? I have this in my custom function file: function enqueue_styles_scripts() { wp_enqueue_style('bootstrap', ...
0
votes
1answer
65 views

Do we need to change our child function.php to require/include child dir files when we add an over-riding file.php into the child theme

With child themes we are supposed to leave parent functions.php in tact and extend it with the child functions.php. However parent functions.php typically define a whole load of include/requires which ...
1
vote
1answer
1k views

Only let plugin add actions to wp_head & wp_footer on single posts

I'm using a a plugin (Comments Evolved) on a recently built site. The issue I'm having is that this plugin globally enqueueing and adding actions to the head and footer of all pages. I'd like to ...
0
votes
0answers
35 views

How to output wp_enqueue_style() in HTML head instead of footer

I added some actions to wp_enqueue_scripts to load my custom css and js files in the header section by using wp_head(); right before the closing </head> tag. function mytheme_scripts(){ // ...
-2
votes
3answers
2k views

Why does wp_enqueue_script ignore my 'wp_head' hook?

I would like css_head_scripts and js_head_scripts to be appended to wp-head but Wordpress completely ignores it? Am I missing something? function css_head_scripts() { wp_enqueue_style( ...
0
votes
2answers
2k views

Deregister scripts on unnecessary pages using remove_action

To all would-be close-voters: This question is not a duplicate, because I need to remove all scripts added by plugin using remove_action. In Very stubborn wp_register_script / add_action vs ...
0
votes
1answer
34 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. ...
0
votes
1answer
356 views

Unable to load stylesheet via wp_enqueue_style

I am using this <?php// Load the theme stylesheets function theme_styles() { // Load all of the styles that need to appear on all pages wp_enqueue_style( 'main_css', ...
0
votes
1answer
25 views

CSS only loads in backend

This works to load CSS in the backend. I'm trying to load the CSS in both the backend and the frontend though. What am I doing wrong here? function load_top_bar_style() { wp_register_style( ...
6
votes
1answer
4k 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' ); }); ...
1
vote
2answers
44 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( ...
0
votes
2answers
36 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 ...
0
votes
1answer
24 views

How to make a cookie be on the whole site instead of being on a specific page/

So I had an idea to make a button that swaps between css files in order to do random stuff such as making 2 backgrounds that the site users will be able to swap between. I had no idea how to do it, ...
0
votes
0answers
30 views

Admin - Dequeue unnecessary scripts/styles

Currently, I'm working on a plugin where I use custom post type. In each post type edit page I've got meta data fields to set advanced functionalities. However, because the interface needs to take ...
0
votes
1answer
25 views

Why isn't my plugin script loaded in the backend?

I've made a WP plugin that needs to load a script in the admin interface. This was working yesterday, but after updating it, it's no longer loading. I have the following code in my functions.php: ...
27
votes
8answers
11k views

Conditionally Loading JavaScript/CSS for Shortcodes

I released a plugin that creates a shortcode and requires a JavaScript file and a CSS file to load on any page that contains that shortcode. I could just make the script/style load on all pages, but ...
0
votes
1answer
37 views

using wp enqueue style to create a CSS file specifically for a page template

I am trying to create a CSS file that only works for one page template. I am trying to do it using wp enqueue style but to no avail so far. I was able to get it to work (sort of) using the following ...
0
votes
2answers
45 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
1answer
40 views

Enqueue less file not working in child theme?

In my child theme I have: add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' ); function theme_enqueue_styles() { wp_enqueue_style( 'parent-style', get_template_directory_uri() . ...
0
votes
1answer
51 views

Customize the reset password page?

How can I style the reset password page, where I put in my new password? I tried going like this: function my_login_stylesheet() { wp_enqueue_style( 'custom-login', ...
0
votes
1answer
26 views

Should I be enqueueing styles/scripts once and then dequeueing them?

I'm new to WP dev and I want to add my own CSS/JS to an existing plugin via an extension that runs after the plugin has loaded (e.g. do_action('plugins_loaded')). This plugin did not have a payment ...
0
votes
0answers
23 views

List all non-admin enqueued files

I am using $wp_scripts and $wp_styles in my admin area to get a list of all css and js files on my site, but only admin registered styles and scripts are being added, I have googled and can't find a ...
0
votes
0answers
45 views

Why is the Dequeue Not Working For All Plugin Styles and Scripts?

I'm trying to increase the load performance a with more sensible loading of admin scripts and styles. I am dequeueing and deregistering scripts and styles where they don't need to be loaded. I've ...
0
votes
2answers
22 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
1answer
37 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 ...
0
votes
2answers
40 views

What is the proper way to include Bootstrap when executing a shortcode

I am trying to include bootstrap only when the short-code function executes. It gets included but it affects the other tags of the theme. The only way I can get around this is including bootstrap ...
4
votes
1answer
4k views

Why wp_register_style() is important while I'm using a complete wp_enqueue_style()? [duplicate]

Currently I'm working on a theme, and did some styles and scripts enqueue. When enqueued the scripts, I used wp_register_script() first, and then enqueued with wp_enqueue_script() - because I got ...
0
votes
1answer
36 views

Load same stylesheet for front end and wp-admin

How can i load same style sheet for both front end and wp-admin of a wordpress site
0
votes
1answer
26 views

Scripts not loading when using the wp_enqueue_scripts action

Really basic, I'm afraid. My scripts aren't loading when I put them as part of a function triggered by the wp_enqueue_scripts action in functions.php. If I put them outside of that action as part of ...
1
vote
2answers
74 views

How to enqueue stylesheets?

I am trying to learn WP theme development. And at the moment I got some problems when I try to enqueue my stylesheet (id does'nt load). It is named style.css and located in my theme folder. I have ...
0
votes
2answers
79 views

Load stylesheet on custom admin submenu page

I'm trying to load a stylesheet for a particular admin submenu page. The code below is what I came up with after looking up admin_enqueue_scripts in the codex: function my_function($hook) { if ( ...
0
votes
0answers
23 views

How to list the scripts and styles enqueued for a certain page?

How do I get all the scripts and styles used on a certain WordPress page. I would like to see the following, Name of script/style URL to script/style Version of script/style And if a certain script ...
0
votes
1answer
149 views

Enqueueing a script and a style sheet not working

I am trying to enqueue both a child theme style sheet and a child theme script. I need to enqueue the script because I put CDN links in there for Bootstrap. I know my enqueue isn't working correctly ...
5
votes
4answers
7k views

Style custom columns in admin panels (especially to adjust column cell widths)

I am using Wordpress as a CMS for a project which makes extensive use of custom post types. I need to display columns in admin panels for each custom post type in a different way. I've already ...
0
votes
1answer
17 views

Why isn't my enqueuing working properly?

I followed this guide to try to enqueue multiple stylesheets in order to get this file picker to work in Wordpress. However, when I am getting an error that says Parse error: syntax error, unexpected ...
0
votes
2answers
110 views

Enqueue styles through the wp_enqueue_style function vs link tag inside header.php

I read that I should insert my style.css file in my theme through the wp_enqueue_style() function because it's not a good solution to add that file through a link tag in the html of the header.php ...
0
votes
0answers
77 views

Stylesheet not loading

I have started on a plugin that shows some basic information of registered users. In order to control layout I want to have a separated CSS file (in plugin-name/css/style.css). However, when I enqueue ...
0
votes
2answers
51 views

How to get rid off default css styles

I have installed html5 blank template and I have created sub theme too by creating style.css and functions.php. But how should I get rid off default CSS styles that come from parent theme?
1
vote
2answers
545 views

Prevent Version URL Parameter (?ver=X.X.X) on Enqueued Styles & Scripts

Use Case I've been experimenting with Chrome's Dev Tools Workspace features. It includes the ability to edit a file directly in Dev Tools and have the saved stylesheet refresh itself (or even compile ...
1
vote
2answers
61 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 ...
5
votes
6answers
3k 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 ...
1
vote
1answer
436 views

Enqueue stylesheets if parent theme has more than one .css file

I just learnt about creating child themes from the Codex , it says to add add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' ); function theme_enqueue_styles() { wp_enqueue_style( ...
0
votes
1answer
33 views

Including Styles and JS files to work ON my plugin interface

Hey WordPress community, I've been having a couple of issues with trying to add a stylesheet and a JavaScript file which run on my plugin interface. So far i have this: ...
0
votes
1answer
29 views

Wordpress-child problem with many css files in parent theme

Ok, So I'm trying to setup a child theme and can't manage to solve the problem with many different css files in parent theme. When I look at codex guide it's just give example on how to setup it with ...