Custom CSS class or ID on menu items that have a Submenu

You could use jQuery, if you’re open to a jQuery solution? <script type=”text/javascript”> jQuery(document).ready( function($) { $(‘#your_menu_id li’).has(‘ul’).addClass(‘has_children’); }); </script> Slight modification of what i posted here basically. Any menu item with a submenu will then have a has_children class you can target in the stylesheet.. #your_menu_id li.has_children { /* your styling */ } #your_menu_id … Read more

Specific css on homepage, different one for other pages

Yes there is. You can add this to your themes header. <?php if(is_home()){ // we are on the home page echo ‘<link rel=”stylesheet” src=”https://wordpress.stackexchange.com/questions/17113/your_stylesheet” />’; } ?> You can also use other conditional tags to find out if you are on nearly every type of WordPress page. Conditional Tags Following on from the comments below, … Read more

Multiple Page Templates & CSS

This isn’t really WordPress specific, but from the server perspective it would add additional http requests for visitors to load additional css files, versus pulling the same site-wide css file from cache. From a css perspective, I prefer to keep it all in one file. Some people prefer to organize things differently, like all text … Read more

Loading different stylesheet on WordPress pages?

Don’t use a shortcode for wp_enqueue_style(); it won’t do any good, because by the time the shortcode is parsed, all the relevant hooks ( wp_head, wp_print_styles) will have already fired. Write a function, in functions.php, to enqueue different style sheets based on is_page( $id ) (where $id can be an ID, slug, or title). Then … Read more

Custom CSS for plugin form

you can check with the_posts hook if your shortcode exists and only enqueue the style if so : function check_for_shortcode($posts) { if ( empty($posts) ) return $posts; $found = false; foreach ($posts as $post) { if ( stripos($post->post_content, ‘[CHANGE_TO_YOUR_SHORT_CODE’) ) $found = true; break; } if ($found){ $url = get_bloginfo( ‘template_directory’ ); wp_enqueue_style( ‘my_login_Stylesheet’,$url.’/my_login_Stylesheet.css’ ); … Read more

Include CSS with PHP without including wp-load?

EDIT Forget my answer below. You could simply use wp_register_style and wp_enqueue_style described in this answer. You could do it with an additional query variable. Add a new variable to the $query_vars array with the query_vars filter On the template_redirect action, make sure your custom.php-css file is included, if the query variable is set. // … Read more

Changing stylesheet depending on custom taxonomy terms

Like Justin Tadlock says in your referenced article, the body_class() provides the ability to add classes dependant on the type of term. Given that you indicate your php knowledge is still growing; this maybe the best solution. The codex provides a list of classes on a body_class enabled: http://codex.wordpress.org/Function_Reference/body_class If that isn’t sufficient; wordpress has … Read more