How to add/insert a class to a sidebar in single.php?

How can I accomplish this in the most efficient way? As Rarst indicates, don’t change the class to change the style. Leave the class the same and use CSS Specificity to change the style on certain pages. When WordPress creates a page in a theme that uses the body_class() function it adds a lot of … Read more

How to make changes to style.php [closed]

To remove the style without modifying the original code you can try add this to your style.css .comment.yes { background: none !important; } This will add a new style for that class. The !important part tells the browser not to let another style over-ride that line.

Stylesheet being loaded outside of

The two stylesheets is only loaded when a video or sound was included in a post or page and that happens after wp_head. But do not despair! There is a filter you can use! in the code it looks like this: apply_filters( ‘style_loader_tag’, “<link rel=”$rel” id=’$handle-css’ $title href=”https://wordpress.stackexchange.com/questions/115412/$href” type=”text/css” media=”$media” />\n”, $handle ); so i … Read more

CSS of the admin panel

One way is to enqueue a style.css for the admin panel. Create a file to say custom-css.css and add css to it and then enqueue it to the admin by putting the below in the theme’s function.php file. function admin_enqueue() { wp_enqueue_style( ‘custom_css’, content_url() . ‘/themes/theme-name/custom.css’); //Please replace the path with the correct path to … Read more

comments_popup_link() – how to load different classes/images according to different comment condition?

Use get_comments_number() to determine the number of comments, and prepare the CSS class with that information: $css_class=”zero-comments”; $number = (int) get_comments_number( get_the_ID() ); if ( 1 === $number ) $css_class=”one-comment”; elseif ( 1 < $number ) $css_class=”multiple-comments”; comments_popup_link( __( ‘Post a Comment’, ‘your-theme’ ), __( ‘1 Comment’, ‘your-theme’ ), __( ‘% Comments’, ‘your-theme’ ), $css_class … Read more

Is it possible to add the_post_thumbnail to style.css?

If you want to add background image you can do inline css in html PHP: <?php if(has_post_thumbnail()) { $desktop_src = wp_get_attachment_image_src(get_post_thumbnail_id(), ‘desktop’); $ipad_src = wp_get_attachment_image_src(get_post_thumbnail_id(), ‘ipad’); $mobile_src = wp_get_attachment_image_src(get_post_thumbnail_id(), ‘mobile’); $desktop = ‘style=”background: url(‘.$desktop_src[0].’);”‘; $ipad = ‘style=”background: url(‘.$ipad_src[0].’);”‘; $mobile=”style=”background: url(“.$mobile_src[0].’);”‘; } ?> HTML: <div id=”desktop” <?php echo $desktop; ?>></div> <div id=”ipad” <?php echo $ipad; ?>></div> … Read more

The Events Calendar Plugin – List View Background Colour Issue [closed]

If I understand you correctly, you can add this code to #tribe-events-content.tribe-events-list in your stylesheet like so: #tribe-events-content.tribe-events-list { margin-bottom: 60px; background: #FFFFFF; /* ADD A BACKGROUND COLOR HERE */ } That will add a background to the Upcoming Events section so that the text is more easily readable. Here’s a screenshot of the change.

CSS is not loaded on mobile devices

After investigation and talking with some sysadmin friends, it happened that there was a .htaccess with rewrite rules for mobile devices in the root of WordPress, in wp-content and in all folders in themes and plugins. I removed all the .htaccess, refresh the root .htaccess with only wordpress needed stuff and everything is good now. … Read more