Hot answers tagged css
4
As alluded to by @Michael in the comments, the CSS classes for widgets depend on the sidebar they're in more than the widget themselves. Those widget-specific CSS classes can be useful, but not when you're trying to style every widget.
It sounds like you may be able to use a normal element selector that targets anything in your sidebar, though I'm unclear ...
4
You could use slugs instead of IDs.
Taken from the Starkers theme (add it to your functions.php):
add_filter( 'body_class', 'add_slug_to_body_class' );
function add_slug_to_body_class( $classes ) {
global $post;
if( is_home() ) {
$key = array_search( 'blog', $classes );
if($key > -1) {
...
3
The Navigation Menus system is adding a lot of classes, including matching current page (rather intelligently, it will even try to detect custom URLs, that were input explicitly).
The simplest class to make use of is current-menu-item, but there are quite a few more dealing with parents/ancestors and more.
Codex has them documented at wp_nav_menu() > Menu ...
3
If you have shell access to an Apache server, Google's Mod Pagespeed is a great way to do so automatically at the server level. It has really powerful options for doing much more than just combining CSS and speeding up your sites.
mod_pagespeed
mod_pagespeed speeds up your site and reduces page load time. This open-source Apache HTTP server module ...
2
Several constants are used to manage the loading, concatenating and
compression of scripts and CSS:
define('SCRIPT_DEBUG', true); loads the development (non-minified) versions of all scripts and CSS, and disables compression and concatenation,
define('CONCATENATE_SCRIPTS', false); disables compression and concatenation of scripts and CSS,
...
2
Well... You've already used wp_enqueue_style. Use it again. That is the canonical mechanism for loading stylesheets either by itself or in combination with wp_register_style
wp_enqueue_style('blackberry',get_stylesheet_directory_uri().'/path/to/blackberry.css');
I feel compelled to note that user agent sniffing is not especially reliable. Is it not ...
1
From the source, reformatted for better readability:
function wp_enqueue_style(
$handle, // unique name
$src = false, // URL
$deps = array(), // array of dependencies, other styleheets unique names.
$ver = false, // version
$media = 'all' // media
)
So, $deps is an array of unique stylesheet handles. If you list the stylesheets here ...
1
Sounds like your Template has 2 style sheets, one that is unused.
By default WordPress will look for style.css in the editor but this doesn't necessary mean its used in the header.php
Take a look at your source code and view which css files are being loaded.
I suspect your see it something like: /wp-content/themes/your-theme/css/blah.css
Rather than ...
1
I agree with you that some of the restrictions on what you can/can't answer on a site titled "WordPress Answers" are a tad ridiculous. That aside, I will actually provide you with an answer rather than argue the point.
Sometimes we have CSS which is only necessary for a single page. This is often the case with things like contact form or archive pages. ...
1
It looks like this display: inline-table; is causing the extra space to appear at the bottom. You can fix it by adding margin: 0 0 -4px; to the item .menu-top-container ul li
I found some help information on these inline objects, here.
It seems to be used to center the menu in that navigation, but it's not supported by IE 7 and below. Maybe you can find ...
1
Always Put wp_head() in header and wp_footer() in footer. the plugin uses this hook
Header.php:
<?php
...
/* Always have wp_head() just before the closing </head>
* tag of your theme, or you will break many plugins, which
* generally use this hook to add elements to <head> such
* as styles, scripts, ...
1
Any changes you make to the plugin's stylesheet will be overwritten when you update the plugin. Likewise with an edit to the theme's stylesheet. Even if you create your own stylesheet and enqueue it via functions.php you will have redo the enqueueing when you update. Of course, if this is a theme (or child theme) of your own creation that isn't a problem.
...
Only top voted, non community-wiki answers of a minimum length are eligible
