Conditionally print css style in WordPress

Use the function body_class() in your templates: <body <?php body_class(); ?>> This creates extra classes on the body element. Then filter its values in your functions.php: add_filter( ‘body_class’, function( Array $classes ) { if ( $GLOBALS[ ‘isBoxedLayout’ ] ) $classes[] = ‘isBoxedLayout’; return $classes; }); Now you can move all CSS declarations for that to …

Read more

With over a page of content the footer remains where the bottom of the screen was at top scroll

Good news, I seem to have fixed the code. I cleaned up the code for #colophon. I changed it from this: #colophon { background:url( repeat-x bottom center; height:80%; width:100%; position:absolute; margin:0; padding:0; bottom:0; min-width:100%; min-height:1%; } To this: #colophon { background: url(“”) repeat-x scroll center bottom transparent; height: 100%; position: absolute; width: 100%; background-size: 100% …

Read more

Black admin bar is being hidden by page elements

The styles for the admin bar are generally printed in the head of the site, so perhaps your CSS code is being undone as the printed styles for the admin bar appear after your included style sheet. Maybe by using the wp_head action you can stop this, placing something like this in your functions file …

Read more

Main menu effect visited

If you mean ‘when the user navigates to page X by clicking it’s menu button’, you can use the current_page_item CSS class. Unless you want to modify the plugin code, I don’t think it’s possible unless you set the current_page_item img {content:…} per menu element.

How to add a css class to custom field value?

It’s very similar to how you set / access theme options: setting: update_user_option( $user_id, $option_name, $newvalue, $global ) <- taken from wordpress codex. and getting : get_user_option(‘color_option’, $userID); To get your specific request fulfilled, you would need to find the user_option(s) and then append to the list via a plugin or theme customization

Applying CSS on PHP variable [closed]

do not use <font> html tag, it is old and i’m not even sure if can work in modern browsers. instead use <span> (for inline text) or <p> (for paragraph). php and html can work together but there’s an appropriate way to write it. generally speaking, html code is wrapped with double quotes “html” and …

Read more

How to avoid repeating similar properties for all tds of a table in a wordpress post

…there’s no way to include the style in WordPress posts, at all? You need to add the style tag to the list of allowed post tags, and also ensure TinyMCE recognises it in the editor: function wpse_180472_wp_kses_allowed_html( $tags, $context ) { if ( $context === ‘post’ ) $tags[‘style’] = array(); return $tags; } add_filter( ‘wp_kses_allowed_html’, …

Read more

a: hover issue with image issues [closed]

This isn’t a WordPress issue, although it IS an easy CSS fix. The small space between the end of image and the slideshow is axtually 2 pixels wide and caused by the #left-area div. You can just up the width by 2 pixels on #left-area. Like this: #left-area { width: 639px; } It is currently …

Read more