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
1answer
32 views

Confused about how to use wp_enqueue_style

I've read the updated codex about using wp_enqueue_style instead of @import. I'm a newb and just flat out confused how to use this. My theme is athletica and my child theme is athletica-child. Do I ...
0
votes
3answers
62 views

Why is my css and js not enqueued until footer?

add_action( 'wp_enqueue_scripts', function ( ) { global $post,$pageparent; if(in_array($pageparent, array($post->ID,$post->post_parent))){ wp_enqueue_style( 'products_pages', ...
1
vote
1answer
43 views

Using multiple versions of jQuery while still calling it like WP likes

I have two JS plugins inside my plugin. One uses jQuery 1.7.1 and the other 1.9.1. I need to have each of them use different version. This is how things are at the moment: Plugin php file: ...
1
vote
1answer
21 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: ...
11
votes
1answer
5k views

How do I dequeue a parent theme's CSS file?

My parent theme (Starkers) adds a CSS file that I'm trying to remove (I want to use @import instead so I can override styles more easily). Starkers has the following in its functions.php: add_action( ...
2
votes
1answer
1k 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 ...
1
vote
1answer
597 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
2answers
655 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
31 views

Prevent a base themes css file from loading

I have created a child theme from the openstrap theme and rather than use Openstraps bootstrap css file, I would like to use my own custom bootstrap css file (using bootstrap custom sass, which is all ...
0
votes
0answers
25 views

Check for Twitter Bootstrap Loaded

I am developing a plugin that uses Twitter Bootstrap Modals, but would like to prevent loading bootstrap if it's already loaded. <a ...
0
votes
0answers
35 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, ...
1
vote
2answers
53 views

Adding Font Awesome to WP Plugin

I'm trying to use font awesome icons for my plugin. I've read this page in the codex and this question. Here's what I've tried so far: I've added this on wp-plug-in.php (or should it be somewhere ...
0
votes
1answer
38 views

wp_enqueue_style in WordPress plugin class not working

I'm trying to add a stylesheet for my plugin class settings page, but the CSS is not loading. I followed the 2nd example at http://codex.wordpress.org/Function_Reference/wp_register_style to create ...
0
votes
1answer
19 views

Different styles on multiple pages

I'm using _s to build a theme. I want to have different styles for different pages. I can figure out how to get two pages working but I want different styles for 5 pages? Maybe an else if statement? I ...
2
votes
1answer
33 views

Stylesheet from wp_enqueue_style is overwritten by plugin

I am using Font Awesome on my theme. wp_enqueue_style('fontawesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css'); I am using another plugin that uses Font Awesome, but ...
0
votes
1answer
79 views

Function to load correct CSS for Template not working

I have three templates I want to be able to use (Index Page, Main Template, and Default). I was able to add a "if/else" statement into a function to get the correct CSS file to load depending on which ...
0
votes
2answers
75 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 ...
2
votes
1answer
130 views

Dynamically Load Styles and Scripts from Theme Functions.php

I am attempting to dynamically load stylesheets and scripts based on the template name. So if I have a template named page-signup.php then it will load the corresponding stylesheet page-signup.css and ...
0
votes
1answer
226 views

Child Theme version is set by parent theme, that isn't correct

I'm using Genesis as my theme framework, and while Genesis is at version 2.0.1, my theme is a different version (1.0). When it adds the style.css line in the header call it is appending the wrong ...
0
votes
1answer
57 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
0answers
20 views

Load mutiple stylesheets inside one IE condition

I want to load Load mutiple stylesheets inside one condition for Internet Explorer: wp_enqueue_style('ie-style', get_template_directory_uri() . '/style-ie.css'); wp_enqueue_style('ie', ...
3
votes
1answer
80 views

Get list of scripts / styles and show file which enqueued them

I want to show what scripts and styles have loaded on a page and which plugin / theme / file has added them to the page. We can show all scripts and styles using: <?php global ...
4
votes
1answer
125 views

Duplicated CSS files using wp_enqueue_style()

I've noticed that in the source code of my website there is Font Awesome loaded five times. Loaded versions are 3.2.1, 4.0.1, 4.1.0 and more. Shortcodes plugins, page builders, the theme and/or ...
22
votes
7answers
8k 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
81 views

How to add php stylesheet to admin section instead of admin_head hook

how can we do the below code using separate file let say admin-style.php add_action('admin_head', 'custom_admin_style'); function custom_admin_style() { $bg_color = get_option('custom_color'); ...
0
votes
1answer
55 views

Parse error syntax error unexpected t_string [closed]

I'm getting the following error: PHP Syntax Check: Parse error: syntax error, unexpected 'qtip' (T_STRING), expecting ')' in your code on line 14 in this code: <?php // Always use ...
0
votes
0answers
56 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
1answer
37 views

Print all inline styles to head

Currently working on a project here http://palanquin.shrimp-works.com. When I try to validate what I have done so far, using http://validator.w3.org/, I get lots of this error Element style not ...
1
vote
1answer
3k views

Inbuilt style for jquery-ui-datepicker

I want to use the datepicker that gets bundled with WordPress on the front end of a website. I enqueued jquery-ui-datepicker but the datepicker isn't styled(no js error in console). Is there a ...
0
votes
1answer
39 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
1answer
158 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
votes
1answer
31 views

Enqueue script/style with multiple GET parameters

I am trying to enqueue a style with two GET parameters, but the output is not correct. Here's what I have: wp_enqueue_style('colors-css', '/root/assets/css/colors.css?style=blue'); The problem is, ...
3
votes
2answers
1k 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
0answers
123 views

Combining multiple stylesheets into one conditional block

I have multiple IE specific stylesheets that I need to add to my theme (combining them is not an option at this time), in addition to the standard ones. I am able to get this to work using the ...
0
votes
1answer
187 views

Hook after wp_enqueue_scripts

I want to perform action when scripts are loaded. I mean when scripts are enqueued i want to take some action. Is there a hook after_wp_enqueue_scripts?
0
votes
1answer
53 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" ...
0
votes
1answer
91 views

Enqueueing a code block from an options framework

I'm currently working with the Redux Framework to allow users of my theme to add additional CSS and JS code to their theme's header and footer, respectively. Redux stores this code in a global ...
2
votes
1answer
28 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
0answers
67 views

How to enqueue stylesheet after rtl.css? [duplicate]

When you use rtl language by default wordpress enqueue rtl.css file at the end of all stylesheets. what I need is how to enqueue a stylesheet after rtl.css stylesheet so the result should be like the ...
8
votes
4answers
5k views

Remove Open Sans from Twenty Twelve theme

I´m creating a child theme for Twenty Twelve v1.0 and I want to remove the Open Sans font. Open Sans is added in Twenty Twelve´s functions.php: wp_enqueue_style( 'twentytwelve-fonts', ...
1
vote
2answers
2k views

How to add dynamic inline style?

I want to add dynamic CSS, so currently I am adding directly to the div, ie: $color = "#000000"; echo '<div style="background:'.$color.'"> Is it bad to add code like above? I have read in ...
0
votes
0answers
45 views

Can I use wp_add_inline_style() inside a function that gets called from a template file (not a hook)?

I'm building a theme that has a 'layout builder', and one of the layout options is a slideshow. There are customiseable style settings for each instance of a slideshow on any page, which means I need ...
0
votes
1answer
269 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
2answers
2k views

wp_enqueue_style for Plugin with multiple stylesheets

I'm making a navigation plugin which adds animations to your wordpress navigation. I read in Wordpress Codex that I would need to use wp_enqueue_style(). First, How do I use this code for multiple ...
1
vote
0answers
74 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 ...
-3
votes
2answers
541 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
3answers
243 views

Asset loading with gulp.js or Grunt

I just started using gulp.js which is a task runner like Grunt and a lot of the sites I work on are using WordPress so I was wondering if anyone has some ideas about how to use the combined scripts ...
0
votes
2answers
21 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 ...
1
vote
2answers
551 views

Override theme style with other CSS on a specific page

The wordpress theme I bought has some jQuery UI styling included in its default CSS file. The problem is I have a plugin that uses jQuery UI and the theme's default CSS makes the plugin corrupted. I ...
0
votes
3answers
1k views

Loading scripts & styles from a meta box callback function

Case: I got a set of classes that build form fields based on data from an input array. The class can build the following types of form fields: input (basic, hidden, password) textarea radio ...