Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #707324

    Hi, I am looking to make some style changes to a post in a certain category. I saw in this post https://kriesi.at/support/topic/different-category-different-style-border-hover/ that there should be a category class added to the body tag, however, in my case, the class is added to the article tag, which is lower in the page than the style I need to adjust. Can you tell me how to make sure that my category class is added to the body tag, so it can be used for the entire page layout? I am using Enfold 3.8 and WP 4.6.1. Thanks, and I hope this makes sense!

    #707416

    Hey janetgot,

    We will surely help you, would you mind providing a precise link to your site, showing the elements in question? We need to be able to inspect them in order to help :)

    Best regards,
    Vinay

    #707426

    Hi, yes, thanks, I’ve included it in the private content…. This is a link to a prototype post, and for all the posts in this category, I’d like to move the content up by removing the top padding of the content class.

    Actually this page is using the Avia Layout, and with that the category isn’t showing up as a class at all. If I just add a post without the avia builder, the category is in the article tag, as in the second link. We want to use the avia builder so we can use a full width banner.

    #707442

    Hi!

    You can inspect elements and target using post ID – http://i.imgur.com/WlYgnPS.png

    .single.postid-452 { opacity: 0.6; }

    Regards,
    Yigit

    #707455

    Yes, but then I’d have to add a class every time I added a new page, which isn’t the question. I thought that a category class was added to the body tag, so I could set a style for every post in a category.

    #707460

    Hi!

    Please add following code to Functions.php file in Appearance > Editor

    add_filter('body_class','avia_single_body_categories');
    function avia_single_body_categories($classes, $class) {
      if (is_single()){
        global $post;
        foreach((get_the_category($post->ID)) as $category) {
          $classes[] = $category->category_nicename;
        }
      }
      return $classes;
    }

    Cheers!
    Yigit

    #1098665

    For custom taxonomies you can use this one
    https://gist.github.com/ChrisLTD/5895564

    #1098929

    Hi,


    @joax
    Thanks for sharing!

    Best regards,
    Yigit

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.