Opened 17 years ago
Closed 16 years ago
#7011 closed enhancement (fixed)
Create wp_print_styles() to match wp_print_scripts()
Reported by: | mdawaffe | Owned by: | mdawaffe |
---|---|---|---|
Milestone: | 2.6 | Priority: | normal |
Severity: | normal | Version: | 2.5.1 |
Component: | General | Keywords: | backpress has-patch |
Focuses: | Cc: |
Description
I've just updated backPress to include both WP_Scripts
and WP_Styles
both of which inherit from WP_Dependencies
(a generic "this thing depends on that thing" class).
Attached is a patch that converts WP over to the backPress classes.
Scripts work just fine; the API has not changed, and the class methods themselves are all backward compatible. Styles are there, but nothing uses them right now. WP should probably have a wp_default_styles()
function (analogous to the patch's wp_default_scripts()
function).
I don't know if we'll use the dependency functionality much for stylesheets (like we do for scripts), or if we just want to use it as a stylesheet queue/loader.
The new files have names that adhere to the backPress naming "standard" (a made up, arbitrary standard). We can name them whatever we like.
svn stat A wp-includes/class.wp-dependencies.php A wp-includes/class.wp-scripts.php A wp-includes/class.wp-styles.php A wp-includes/functions.wp-scripts.php A wp-includes/functions.wp-styles.php M wp-includes/default-filters.php M wp-includes/script-loader.php M wp-admin/admin-header.php
Attachments (4)
Change History (13)
#2
@
17 years ago
As for file naming, we typically use class- and bundle wrapper functions in with the class. I haven't a strong preference, however.
#3
@
17 years ago
7011.b.diff
- Adds
wp_default_styles()
that registers core CSS. - Converts
wp_admin_css()
which now *enqueues* if possible, and prints if we've already printed the queue. No more annoying one off functions adding a call towp_admin_css()
inadmin_head
. - Adds support in
WP_Styles
for RTL stylesheets and conditionally loaded stylesheets. - Switch from
clean_url()
to {{{attribute_escape()}} so that URLs could be relative. Bad idea?.
#5
@
17 years ago
- Owner changed from anonymous to mdawaffe
- Status changed from new to assigned
7011.d.diff
- Add
$force_echo
parameter towp_admin_css()
. - Add
admin_print_styles
action to a few files that don't use admin-header.php. - Use the above 2 to fix style printing/queueing on files that don't use admin-header.php.
- Manually register colors-fresh for the sake of wp-login.php. colors-classic or others are not needed. Slightly hacky.
- Remove all one-off functions that add a
wp_admin_css()
call toadmin_head
or similar. - Deprecated
wp_admin_css( 'css/whatever' )
in favor ofwp_admin_css( 'whatever' )
.
#7
@
17 years ago
All works very well, now css files can be registered, deregistered, enqueued, etc. like the js files.
A small side note: the way the RTL css files are added in script-loader.php is a bit hard to read. Perhaps we could add them one by one under each corresponding css file, with paths, like wp-admin.css. It will make it slightly bulkier, but would be a lot easier to read/edit (and the conditional is_bool() can be removed from class.wp-styles.php).
(In [7970]) Style loader from mdawaffe. see #7011