add css to only body text

On your CSS rule for the .single img, you are currently setting only the maximum width, and the padding you set applies to the image itself within the body’s box. Try setting the image to full width and pulling the sides out with negative margin: .single img { width:100%; margin: 0 -100px; }

different body classes for each category

If i understood what you are lookin for, this should work, it uses get_queried_object() function: // Adding categories name to body class on archives add_filter(‘body_class’,’add_category_to_body_class’); function add_category_to_body_class( $classes ) { // check if in category if ( is_category() ) { // get the queried object, in this case, a category object, and assigns to a … Read more

Creating custom post-listing templates in twentyseventeen child theme

You can use the Body Class Filter for this to adjust the classes being added to the body tag. add_filter(‘body_class’,’review_pages_classes’); function review_pages_classes($classes) { $classes[] = ‘blog’; return $classes; } Which classes you need to add or remove is probably a matter of trial and error, or looking at the stylesheets in more detail.

Add class when more page is visited

It seems you are looking for body_class() You can read more here A solution for adding a body class to a specific page template: add_filter( ‘body_class’, ‘custom_class’ ); function custom_class( $classes ) { if ( is_page_template( ‘page-example.php’ ) ) { $classes[] = ‘example’; } return $classes; } The result on the front-end: <body class=”page page-id-7 … Read more

How do i add a unique body class to the wordpress dashboard’s home page?

If I’m not mistaken, you could just use body.wp-admin.index-php to target the dashboard. If you want to add something else, you can use the admin_body_class filter to manipulate the classes added to the body and check what is displayed with get_current_screen: add_filter(“admin_body_class”, function($classes) { $current_screen = get_current_screen(); if($current_screen->base == “dashboard”) { $classes .= ” dashboard”; … Read more

Adding body class to html tag that already has language attrubutes?

Maybe you could use a filter to add the current language of the website to the body class. add_filter(‘body_class’, ‘language_in_body_classes’); function language_in_body_classes($classes) { $classes[] = get_bloginfo(‘language’); return $classes; } Edit : maybe I misunderstood what you wanted. There is actually a language_attributes filter but I do not think it would be very standard to add … Read more

Body class to each level of a hierarchical custom taxonomy

Use is_tax instead of is_category, and update get_ancestors to get taxonomy from the queried object: add_filter( ‘body_class’, ‘custom_cat_archiev_class’ ); function custom_cat_archiev_class( $classes ) { if ( is_tax( [‘custom_tax_1’, ‘custom_tax_2’] ) ) { $term = get_queried_object(); $ancestors = get_ancestors( $term->term_id, $term->taxonomy, ‘taxonomy’ ); $classes[] = ‘catlevel-‘ . ( count( $ancestors ) + 1 ); } return … Read more