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
2answers
107 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
1k 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 ...
4
votes
2answers
1k 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
202 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
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', ...
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( ...
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
317 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
156 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 ...
0
votes
3answers
1k views

What can I hook into after_setup_theme?

I'm wondering what can I or should I NOT hook to after_setup_theme? I'm wondering because I have been told that I shouldn't hook wp_enqueue_style to it, but I have seen other places using it to hook ...
0
votes
1answer
192 views

Having issue with WordPress wp_enqueue_style

I am building a full design into WordPress for the first time and I am trying to load in stylesheets and script files but all I seem to be getting is the text output of the location. What I have is ...
2
votes
2answers
4k views

wp enqueue style on specific page templates

I am in the process of a theme, I would like to add landing pages using page-templates. I cannot find anywhere that shows how to enqueue style or js for specific page templates. Any suggestions. Ex. ...
0
votes
1answer
731 views

Enqueue styles after a plugin

Is there a way to enqueue my style.css (and other stylesheets) AFTER a certain plugin enqueues its styles? Specifically, I want my style.css to overwrite cforms's styles, but when I change the ...
0
votes
1answer
79 views

admin_print_styles incuding $_SERVER['DOCUMENT_ROOT']

All the Javascript isn't working in the admin area on my production server. Locally it works fine. I have narrowed it down to /wp-admin/wp-header.php line 72-78 do_action('admin_print_styles'); ...
3
votes
1answer
116 views

Hyphens vs. periods in the script slug in wp_register_script?

I have seen script and style handles written in two different ways in wp_register_script and wp_enqueue_script (the same applies to wp_register_style and wp_enqueue_style): wp_register_script( ...
1
vote
3answers
2k views

How do I force wp_enqueue_scripts to load at the END of <head>?

I am loading scripts via wp_enqueue_scripts in my child theme. The only problem is that my style.css script get loaded BEFORE plugin scripts, yet I need to override the css in the plugins with my ...
0
votes
1answer
235 views

CSS not being applied using wp_enqueue_style

I am trying to load my style sheets in my plugin but they are not being called, the javascript files however, are being loaded. <?php /** Plugin Name: Plugin URI: Description: Version: Author: ...
2
votes
3answers
278 views

Is it possible to enqueue a raw CSS string directly from within a template file?

I was wondering if it's possible to enqueue raw CSS as a string directly from within a template file? I'm writing a custom template for a page and need to add some style rules for it. What I want to ...
3
votes
1answer
233 views

TinyMCE custom stylesheets for different post types

I use a custom stylesheet for TinyMCE, by placing custom styles in editor-style.css in my theme's directory. I am trying to figure out how to use a different stylesheet depending on what post type we ...
0
votes
1answer
273 views

Enqueueing Scripts/Styles mid-page

Since WP 3.3, the codex has been updated for both wp_enqueue_script and wp_enqueue_style that you can now enqueue both mid-page (within the HTML body). I see this as an advantage because: It's ...
1
vote
2answers
283 views

Enqueued scripts and styles loading in WordPress Dashboard as well

For a moment, I wondered if my test site got hacked -- my WordPress site's dashboard was all broken (cosmetically). But when i looked at the source code of the page, I noticed that the "scripts and ...
1
vote
1answer
983 views

How do I make header.php use different css for different pages?

I register styles in function.php with function my_scripts() { wp_deregister_style( 'header' ); wp_register_style( 'header', get_template_directory_uri() . '/css/header.css' ); ...
2
votes
2answers
1k views

When enqueing a stylesheet, is it possible to remove the type attribute?

I'm updating my self-built theme to HTML5, and easily made a number of changes already. My theme's sole stylesheet is added to the page head via wp_enqueue_style in the functions.php file, as ...
0
votes
1answer
674 views

Use conditionals with wp_enqueue_style to attach stylesheet according to post type displayed

I have many custom post types, including some introduced by plugin such as bbPress or WooCommerce. My standard stylesheet is growing large, so I thought to split it into multiple stylesheets ...
3
votes
2answers
6k views

Notice that the wp_enqueue_style is not being called correctly!

I get this error due to one of the plugins which I rely on. Notice: wp_enqueue_style was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, ...
1
vote
2answers
103 views

Making a plugin only available on the front-end for the logged in super admin

I made a little plugin that enqueues 1 .js file and 1 .css file into a theme's front-end. All it does it load a grid on top of the theme so I can visualise the design. If this plugin was activated ...
0
votes
1answer
218 views

Proper use of wp_enqeue_style

I have the following code in my functions.php file. It works, but I am wondering if this is best practice for including styles in wordpress. Also do I need to register the style with wp_reister_style, ...
0
votes
1answer
92 views

How can I print out a single stylesheet or javascript link?

I know I can use enqueue_script and enqueue_style to register scripts and stylesheets, however I'm trying to print out just the link to the adminbar css: <link rel='stylesheet' id='admin-bar-css' ...
13
votes
3answers
2k 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 ...
1
vote
2answers
2k 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 ...
17
votes
5answers
8k views

How do I enqueue styles/scripts on certain /wp-admin pages?

I have two simple functions that load stuff using wp_enqueue_style() and wp_enqueue_script(), something like these: function admin_custom_css() { wp_enqueue_style( 'stylesheet_name', ...
5
votes
1answer
1k views

Load js/css files only on specific admin UI pages

How do I adapt this solution to work with my plugin? (Please see the link). I enqueue my css and js script as follows: function my_plugin_init() { wp_enqueue_script('my_plugin_script', ...
2
votes
2answers
3k 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 ...
2
votes
1answer
1k views

How to use wp_enqueue_style() and wp_enqueue_script() only when needed?

My plugin uses wp_enqueue_style() and wp_enqueue_script() to load resources, but I have kept in mind not to degrade the performance for the user and only load these when the current set of posts ...
1
vote
2answers
258 views

getting url in wp_enqueue_style

I'm having trouble getting the second argument in wp_enque_style. Here's how my site is setup: style.css custom_style.css index.php In a template, I have this code: $stylesheet_url = ...
1
vote
3answers
810 views

Add 'title' attribute to stylesheets with wp_enqueue_style()

Read below if you want to start from where I left off in core. But the basic question is: I need to add a "title" attribute to my stylesheets and wp_enqueue_style() doesn't allow for that parameter, ...
1
vote
3answers
3k 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
52 views

How to check via conditional tags for a single plugin page?

I am developing a plugin. To embed the stylesheet I used wp_enqueue_style(). I want the CSS file to be only implemented at the plugin's page. I have already seen solutions with conditional tags, but ...
1
vote
1answer
1k views

wp_enqueue_style with style.php and Wordpress functions

I use wp_enqueue_style to add my stylesheet, like this: <?php wp_enqueue_style( 'theme-style', get_template_directory_uri() . '/style.php', false, '1.0', 'all' ); ?> It works fine BUT I need ...
6
votes
1answer
5k views

How to load Widget javascript + css files only if used?

I'd like to keep the javascript and css styles used by my widget inside their own files (and not add them to the theme). But i can't seem to get wordpress to add them when the widget is actually used ...
0
votes
1answer
1k 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( ...
0
votes
1answer
178 views

Enqueuing a script before anything else

I wondered if it was possible to change the order in which a script is enqueued. I ask this because I wish to include the HTML5 enabling script but it needs to be included before any styles. Is ...
0
votes
2answers
1k views

Adding style sheet to specific page

I have set a page as a homepage for my site. There are specific style sheets just for the homepage that I don't need to use globally. I'm still new to WordPress so this is so confusing to me. I ...
27
votes
1answer
6k views

Where is the right place to register/enqueue scripts & styles

I am using WordPress 3.1.4 by now. I am confused with where (which hook) do I use: to register and/or enqueue scripts and styles on front- and back-ends? Questions: Which are right hooks to ...
1
vote
1answer
727 views

Loading different stylesheet on Wordpress pages?

I have one stylesheet linked to my Wordpress page in header section: <link rel="stylesheet" type="text/css" href="<?php bloginfo('template_directory'); ?>/style.css" /> Now, I want to ...
7
votes
4answers
2k views

LESS CSS enqueue_style with add_filter to change rel attribute

What I'm trying to do is use less css with Wordpress. You're supposed to link to your .less files with the rel attribute set to 'stylesheet/less'. But I can't figure out how to alter the code that ...
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
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 ...
3
votes
2answers
2k views

How can I de-register ALL styles all at once? And same with Javascript?

How can I get all enqueued styles or scripts and then deregister them all at once?