ThemeShaper Forums » Thematic

[closed]

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
    Member

    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?

    Thanks

    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";
    }
    add_filter('thematic_open_id_content','change_content_class');

    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";
    }
    add_filter('thematic_open_id_content','change_content_class');
    Posted 9 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.