Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter zipiz

    (@zipiz)

    I owe you a beer. Big thanks ??

    Thread Starter zipiz

    (@zipiz)

    It’s me again. Can you please modify this code above to

    a) remove all classes from the body tag except the ones generated by the code

    b) add the same genericClass to all pages that are not in a category (tag pages, author pages, search pages etc.)

    I dying to figure it out. Your help is much appreciated.

    Thread Starter zipiz

    (@zipiz)

    You are awesome! It works brilliantly. Thank you so much!

    Thread Starter zipiz

    (@zipiz)

    I’m not a coder so all I can do is try to understand the code and copy/paste code others provide.

    The first link shows how to add the actual category name in the body, but not the top-level category (parent/root category).

    From the second link I tried several code snippets and again, they do not display the parent/root category in the body class.

    From the third link I do not quite understand how to make a code snippet off the information there to display the parent/root category in the body class.

    is that for category archives and/or single posts?

    For single posts and category archives.

    what if a single post has several categories?

    You make a valid point there. I totally forgot about the case of multi categories. In this case, I simply want to add a generic class in the body tag. I believe this should be doable with a conditional. Something like

    if (categories more than 1)
    echo ‘genericClass’;

Viewing 4 replies - 1 through 4 (of 4 total)