ThemeShaper Forums » Thematic

Change body class

(6 posts)
  • Started 5 years ago by gelay
  • Latest reply from matthanson
  • This topic is resolved
  1. How can I change body class from "wordpress" to xxxx using functions.php?

    Posted 5 years ago #
  2. Hey,

    try this one:

    function repl_wp($bc) {
    return str_replace('wordpress', 'whatever', $bc);
    }
    add_filter('body_class','repl_wp');

    Cheers,

    Chris

    Posted 5 years ago #
  3. Hi Chris, Is it possible to change body class according to category within functions? (Want a simple way to change the background colour of the page depending on category.)

    Posted 5 years ago #
  4. Hey Matt,

    there's no need to change anything except of your style.css :-)

    Try this one:

    body.s-category-YourCategory {background:red;}

    This will display a red background on all single pages with a post listed in category YourCategory.

    Cheers,

    Chris

    Posted 5 years ago #
  5. Works!!! Thanks Chris.

    Posted 5 years ago #
  6. Chris, thats perfect. Thanks!

    Posted 5 years ago #

RSS feed for this topic

Reply

You must log in to post.