ThemeShaper Forums » Thematic

[closed]

How to insert div around subsidiary div?

(9 posts)
  • Started 3 years ago by malinki
  • Latest reply from 4rederick
  • This topic is resolved
  1. Pls be gentle with me...

    I would like to make the background of the subsidiary asides full width and apply a nice colour to it.

    If I was in html I think I'd add another div around <div id="subsidiary"> and set it's colour and width (so all the asides would stay centred using the margin: 0 auto; that's in the css).

    I've figured out how to add an extra div in the footer by adding:
    // Customising footer
    function childtheme_footer_extradiv() { ?>
    <div id="footer_extradiv">
    </div>
    <?php }
    add_action('thematic_footer','childtheme_footer_extradiv');
    ?>

    to functions.php

    But adding another div 'around' and existing div has stumped me (I've only done html and css up to now).

    Can anyone help out?

    Cheers!

    Posted 3 years ago #
  2. Hv found another way to achieve what I'm looking for.

    Posted 3 years ago #
  3. mailinki, what was your solution? I'm trying to do the same thing I believe you were trying to do, centering the 3 subsidiary asides in the footer. Did you end up figuring out how to add a div wrapping all three? Thanks.

    Posted 2 years ago #
  4. Are you using a child theme? If so, I believe you can just copy the footer.php file from Thematic, put it in your child theme folder, and then wrap the footer <div> with your additional <div>. This may not be the "correct" way, but I think it works and keeps you safe from future Thematic updates.

    Posted 2 years ago #
  5. middlesister
    Member

    I does work but if thematic decides to change the format of the footer file, you would have to copy the file again and add the div again. A bit more futureproof way is to add the opening and closing <div> tags with action hooks.

    function add_opening_divtag() {
    	echo '<div>';
    }
    add_action('thematic_abovefooter' , 'add_opening_divtag');
    
    function add_closing_divtag() {
    	echo '</div>';
    }
    add_action('thematic_belowfooter' , 'add_closing_divtag');

    If you want to add the wrapping div just around the subsidiaries, then you need to use priorities since there are several other things added to the thematic_footer hook (the subsidiaries has a priority of 10).

    function add_opening_divtag() {
    	echo '<div>';
    }
    add_action('thematic_footer' , 'add_opening_divtag', 5);
    
    function add_closing_divtag() {
    	echo '</div>';
    }
    add_action('thematic_footer' , 'add_closing_divtag' 15);
    Posted 2 years ago #
  6. middlesister, I wanted your last code suggestion to work so badly, unfortunately it didn't. Parse error. Not anywhere close to even an amateur with php coding, I can't see if there is a mistake somewhere. ?

    Posted 2 years ago #
  7. my unfinished site is josephfrederick.com

    Posted 2 years ago #
  8. middlesister
    Member

    Ah yes there is a typo. A missing comma.

    function add_opening_divtag() {
    	echo '<div>';
    }
    add_action('thematic_footer' , 'add_opening_divtag', 5);
    
    function add_closing_divtag() {
    	echo '</div>';
    }
    add_action('thematic_footer' , 'add_closing_divtag', 15);
    Posted 2 years ago #
  9. That works great, middlesister. Does exactly what I wanted. Unfortunately I'm not quite there yet. Started a new thread though ...

    http://forums.themeshaper.com/topic/wrapping-footer-subsidiaries-in-new-div-positioning?replies=2#post-21274

    Posted 2 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.