ThemeShaper Forums » Thematic


Add class tag to <div id="content">

(8 posts)
  • Started 12 years ago by antesark
  • Latest reply from antesark
  • This topic is resolved


  1. antesark


    How can I add class="my_class" tag to <div id="content"> without modifying the base thematic theme files (page.php, archives.php etc)?

    Posted 12 years ago #
  2. antesark


    Posted 12 years ago #
  3. Hi,

    I could create a filter for this. Something like thematic_open_container_id. This could be filtered using:

    function add_container_class($markup) {
        return '<div id="container" class="my_class";
    add_filter( 'thematic_open_container_id', 'add_container_class' );

    With additional if-clauses you could define different classes for index, single, page, and so on.

    Let me know if this would solve your problem.


    Posted 12 years ago #
  4. antesark

    Thank you Chris for your answer. That would be perfect!

    Actually I need to add the class-tag to the div id "content", not to container, but ofc I can modify it as I like if you just open the whole container div so it can be modified (and everything inside it).

    Bottom point, I just need to add class="eqh" to div content.

    And if your interested, the reason I need this class is so I can apply thematics equal height javascript to fix sidebar/content overflow (got sidebar on position: absolute).

    The site I'm working on is located at ..

    With best regards, Ante

    Posted 12 years ago #
  5. Hi Ante,

    grab the current SVN copy. I integrated the new filter thematic_open_id_content.

    The following code will add your class to #content:

    function add_my_class() {
    	return '<div id="content" class="my_class">' . "\n";
    add_filter( 'thematic_open_id_content', 'add_my_class' );



    Posted 12 years ago #
  6. antesark

    Thank you Chris, it worked like a charm. Tho I run into some problems with childtheme_override-functions. Content seemed to be printed twice.


    function childtheme_override_siteinfoclose() { ?>
    <span class="float-right">This page took <?php echo timer_stop(); ?> seconds to load</span>
    </div><!-- #siteinfo -->
    <?php }
    add_action('thematic_footer', 'childtheme_override_siteinfoclose', 40);

    You can check this out at .. located at the footer obviously. Had the same problem with childtheme_override_brandingopen/brandingclose. The header img got printed out twice, but fixed it with not using override-function at all.

    Posted 12 years ago #
  7. Aarrgh ..

    Ante, I hereby declare that you are officially allowed to use the hashtag #blamethematic4you in all your tweets talking about bugs in Thematic ;)

    Remove the add_action() part. Normally all childtheme_override_ actions should be hooked automatically to the proper action hooks. Unfortunately I had a couple of add_action() calls inside of the if-clause. This was fixed in the latest SVN copies.


    Posted 12 years ago #
  8. antesark

    Hehe.. :) Gah, that was simpple, should have figured that out by myself, tried quite a few things, but ofc did not try to remove the add_action.

    Thanks again. Keep up the good work!

    Posted 12 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.