use add_action(‘wp_head’) in a widget for generating dynamic CSS styles

Once the widgets are being evaluated, the head of your site is completed, so you cannot use wp_head anymore. Adding <style> tags is an option, but will indeed generate a warning from the validator. Using the customizer is possibly confusing, because it is supposed to be about theme looks in general, not about specific widgets. … Read more

Get parent category class in post_class()

Perhaps something like: function mytheme_get_post_class_parent_cats() { $parent_cat_classes = array(); // Get parent categories $post_cats = wp_get_post_categories(); // Loop through post categories foreach ( $post_cats as $post_cat ) { $cat_parents = get_category_parents( $post_cat , false, ‘,’, true ); // if there are any parent categories if ( $cat_parents ) { // create an array $cat_array = … Read more

How to implement different color schemes in your themes

I would put all the common css in the theme’s style.css, and create separate stylesheets for the color options. I would also put color options in their own folder with the images for that style. This way you can keep the filenames the same between color options to make maintaining the code a little easier. … Read more

How to Add Admin Bar and Admin Menu or Submenu Notification Bubbles?

You just create the bubble (circle) with CSS, and have text site on top of it. Example CSS span.mbe-update-bubble{ position: absolute !important; top: 6px !important; left: 6px !important; -webkit-border-radius: 10px !important; -khtml-border-radius: 10px !important; -moz-border-radius: 10px !important; border-radius: 10px !important; background: #ccc !important; color: #464646 !important; width: 10px !important; height: 10px !important; padding: 3px !important; … Read more

front-page.php stylesheet

How to load a custom stylesheet for your Front Page Set up front-page.php (which you’ve done already). Create a stylesheet for your front page (you can copy style.css, but more likely, you’ll just want to override a few things). Let’s call it front-page-style.css. View the HTML source of one of your pages, and find the … Read more

Which Details Are Required For Style.css File Header?

A quick test indicates that you don’t actually need anything in that header for standalone theme. A theme with a completely blank header registers and loads just fine, both front and back end. If it is a child theme you need the Template: line. However… In addition to CSS style information for your theme, style.css … Read more