ThemeShaper Forums » Thematic


Adding class to content div

(3 posts)
  • Started 9 years ago by mikeward
  • Latest reply from Jonny Janiero
  • This topic is not resolved
  1. mikeward

    I am sorry if this is a repeat but I cannot find a valid solution.

    I would like to add a class to the <div id="content"> to make it say <div id="content" class="grid_18"> or something along those lines. I have code working for the primary and secondary asides but cannot get it to work for the content div. Can anyone help?


    Posted 9 years ago #
  2. well taking a quick look at any of the templates i see

    echo apply_filters( 'thematic_open_id_content', '<div id="content">' . "\n" );

    so i believe you ought to be able to filter it

    function change_content_class(){
       return <div id="content" class="grid_18">' . "\n";

    totally untested

    Posted 9 years ago #
  3. yes, that solution should work.
    you could also use conditional tags to display a different class value for different layouts, etc.

    function change_content_class(){
       if (is_category() {
          $class =  '<div id="content" class="grid_18">';
       } else {
          $class =  '<div id="content" class="grid_22">';
       return $class . "\n";
    Posted 9 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.