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

0
votes
0answers
68 views

What is the optimal add_editor_style() development or maintenance workflow?

It appears to me that add_editor_style() creates a burdain of having to maintain two stylesheets for an identical subset of rules. What is the optimal workflow to minimize this burdain? My first ...
1
vote
3answers
153 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" ...
0
votes
1answer
195 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 ...
1
vote
3answers
183 views

The best way to add stylesheets to WordPress

I am in the process of converting a mobile responsive page, currently built in Bootstrap into WordPress. Using wp_register_style() and wp_enqueue_style() will add the stylesheets to all pages, ...
0
votes
1answer
123 views

wp_enqueue_style url is trimmed somehow

I am using a plugin that adds a style with wp_enqueue_style(). When I look at the page source I find this line: <link rel='stylesheet' id='ai1ec_style-css' href='http://heseg.com/' ...
0
votes
1answer
71 views

How to enqueue scripts in right way in a plugin?

I am developing a wordpress plugin and just came out with a problem with enqueue scripts. I want to enqueue JQUERY UI (.js) and (.css) in my plugin. Is it better to enqueue it from Google CDN or ...
0
votes
1answer
67 views

wp_enqueue doesn't load dependencies

I'm trying to load style.css but rest.css should be included first. I don't understand why reset.css is not included function addMyScript() { wp_register_style('style', ...
3
votes
2answers
769 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 ...
0
votes
1answer
482 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
1answer
53 views

Checking for 'gallery' shortcode using strpos always returns false

I want to conditionally enqueue a script and stylesheet depending on whether the [gallery] shortcode is used in posts. Here is how I am doing it (based on): function doraemon_scripts() { if( ...
2
votes
3answers
128 views

How to detect if a function has been fired on any page so scripts/styles can be loaded conditionally

I'm building a small gallery plugin and I'd like to only load scripts/styles onto the page IF the gallery has been loaded via the template tag. The template tag can take a post ID parameter when used ...
1
vote
2answers
1k 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 ...
1
vote
2answers
61 views

Enqueue never runs

My enqueue scripts are never called I can't figure out why. All my paths are correct and I'm assuming the code is correct Functions.php function tim_enqueue_default_scripts() { if (ENVIRONMENT ...
1
vote
3answers
121 views

Enqueue stylesheets with the same name

Ok, maybe i'm thinking too difficult, but I have 2 stylesheets with the same name. One is from the parent theme folder, and one from the child theme folder. I want to enqueue the style from the child ...
0
votes
1answer
88 views

Why enqueue styles on hook

Why do we need to enqueue styles on a hook, why not just enqueue them straight in like this? wp_enqueue_style( $handle, $src); the codex page gives an example of using a hook but doesn't explain ...
1
vote
1answer
188 views

Removing an action, or dequeueing style - Both not working

What I am wanting to achieve is to remove an action called inside of another action. The action is calling a style, and although I have tried to deregister, and dequeue the style, it is still ...
1
vote
1answer
166 views

How can I let templates choose which stylesheets are enqueued?

My theme's functions.php hooks into wp_enqueue_scripts to register a couple of stylesheets that are used by various site pages. Here's a simplified version of my configuration: ...
4
votes
1answer
3k 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 ...
0
votes
2answers
72 views

wp_enqueue_scripts hangs

In the following snippet, when I add the wp_enqueue_scripts call, the page freezes. What am I doing wrong? function my_enqueue_stuff() { if ( is_front_page() ) { wp_enqueue_style('style', ...
0
votes
0answers
54 views

How to load script-related styles automatically?

Scenario: It is common that a JS dependency is bundled with a style file to work properly (just think about your favorite slideshow jQuery plugin). AFAIK, in this situation, the script and style have ...
1
vote
1answer
320 views

wp_enqueue_style will not let me enforce screen only

I am using Roots as the starter for a theme I have been working on. I then generated a print.css file, but in Chrome's case, it still is using the bootstrap-responsive.css queries, and messing things ...
0
votes
0answers
136 views

wp_register_script stops wp_enqueue_style working

Ambiguous title, yes. Sorry. I am using the roots framework to register scripts and stylesheets. When I include the wp_enqueue_script('main_js'); my style sheets come out as <style media="" ...
0
votes
1answer
1k views

get_stylesheet_uri returns wrong path

I am using the roots theme. Inside scripts.php, the stylesheets are loaded using the wp_enqueue_style-function. wp_enqueue_style('roots_bootstrap', get_template_directory_uri() . ...
1
vote
1answer
378 views

wp_enqueue_script Doesn't Work?

It's pretty standard, I enqueue script and style for admin page. function admin_custom(){ wp_enqueue_script('js', plugins_url('adm.js', __FILE__)); wp_enqueue_style('css', ...
0
votes
2answers
101 views

Display Something in the Header After All Styles are Loaded

I'd like to include a functionality in a theme that will overwrite styles from previously included CSS files. For this purpose, I need to be able to display a <style> in the header after ALL ...
1
vote
2answers
4k views

How to enqueue the style using wp_enqueue_style()

I'm developing a theme. I added the codes (below) into the header.php. But I posted it into the WP theme repository, and it's under review, and the reviewer informed me to enqueue the style with ...
3
votes
1answer
547 views

How to combine multiple CSS files and concatenate JavaScripts if WordPress recommends enqueuing them?

How would I go about combining multiple CSS files and concatenating my scripts if they're being enqueued as WordPress recommends? My site is pretty slow and would like to optimize for performance.
0
votes
1answer
74 views

Enqueue ONLY Plugin Styles and Scripts

Is there a way to enqueue only plugin styles and scripts without wp_head? I have a plugin I'm working on which overrides the page template, but I still want to include all other plugins without ...
-1
votes
3answers
126 views

Trying to get styles to register than enque

I have the following code in my functions.php file with a call in the header, but nothing is being outputted in the html. There are no stylesheets. I have tried that add action wp_enque_styles with ...
1
vote
2answers
86 views

Why are my styles being applied to the admin area?

All my enqueued styles are applied to the back-end as well. I have never encountered this behavior before. Here's my code: wp_register_style( 'main-styles', get_stylesheet_directory_uri() . ...
0
votes
1answer
263 views

Register script/style: Is it possible to customize the version query string via plugin?

Expanding on the question in the title: I would like to find a way (via a plugin) to use timestamps for the JS and CSS file version query strings that are output with wp_register_style and ...
1
vote
0answers
63 views

Need help enqueueing webfonts

I am attempting to enqueue web fonts that I am loading in via the WebINK font library. (This service is similar to Typekit). This service works by generating a unique CSS link for each unique site. I ...
0
votes
2answers
166 views

Is the wp_enqueue method efficient?

I had a quick question regarding how you are supposed to load in scripts with Wordpress. I am developing a theme and I know that the best way to do this is to use the ...
1
vote
1answer
2k 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
2answers
164 views

All of my Scripts and Enques are getting file not found

I have the following script and enque function, and the site properly renders it in the html head, however when I click the link to the css and javascript files the i get a url not found, however the ...
1
vote
2answers
460 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 ...
17
votes
2answers
496 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 ...
1
vote
1answer
109 views

Fixed layout for admin section

I would like to customize the layout of the admin section of WordPress. The thing is, whatever the layout I create, I'm very dependent of the default "fluid" layout of the admin. By fluid, I mean: ...
5
votes
4answers
3k 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', ...
0
votes
1answer
183 views

plugin's script and style enqueing not working on Thesis

I've published a plugin on WP repository that allows some theming for Gravity Forms. This plugin as been tested with Twenty Ten, and Twenty Eleven. When I've tried to test it in a site that uses ...
0
votes
2answers
100 views

How do I use a color from theme options?

I am building a theme, and in the options I have created a place for link color. I cant seem to get this into the theme in any reasonable way. The best I can do is to put it after wp_head ... but that ...
0
votes
1answer
1k views

Custom Admin CSS styles to style media uploader?

Hopefully a simple answer to this. Using the wp custom header feature, the media upload screen shows an extra field: "set as header". I'm trying to make this text bigger as it can easily be missed. ...
0
votes
1answer
865 views

Deregister a CSS file that comes with a plugin

WPML plugin comes with its own CSS file. I want to get rid of all the CSS it contains, so I put everything between /* */. However I'll have to do that again when I'll update the plugin. Is there a way ...
3
votes
2answers
961 views

How Would You Enqueue A Google Web Font?

I'm using the Rosario font from the Google Web Fonts in my theme and I want to enqueue the font so that if there was ever a plugin that used a fancy font that there wouldn't be any conflicts or wasted ...
0
votes
1answer
197 views

How to use wp_enqueue_script, style when required

There are lot of unused js & stylesheets in my theme. here is wp_register function in my functions.php wp_register_script( 'moder', base_url . 'js/modtom.js', array(), false, false ); ...
8
votes
4answers
4k 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', ...
7
votes
1answer
4k views

How do I dequeue a parent theme 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( ...
0
votes
1answer
2k views

Remove a script from a template file using wp_dequeue_script

I thought I had read it was possible to use wp_enqueue_script() and wp_dequeue_script() directly in individual template files. However, when I add wp_dequeue_script( 'myscript' ); to the top of ...
1
vote
1answer
299 views

Whats the proper way to use a php stylesheet in a wordpress theme? [duplicate]

Possible Duplicate: How can I use WordPress functions in my stylesheet? I have a file, custom.php, thats basically a stylesheet with php variables for the styles. I used this guide to make ...
0
votes
1answer
155 views

Background of default template showing instead of the background of custom page template

Plugins were not working for my custom page template, found out that I needed to put WP_head() and WP_footer(), so did that and the plugins started to work. But now the background changed to that of ...