ThemeShaper Forums » Thematic


add a div in the sidebar

(10 posts)
  • Started 8 years ago by dynamitharry
  • Latest reply from Minimalist
  • This topic is resolved
  1. dynamitharry


    I want to add a div in the sidebar, i have found this in the widgets-extentions.php<div id="primary" class="aside main-aside">and under this i want to add just a div like this <div class="div"></div>.. Need it for styling.. how can i add this with a filter?

    Posted 8 years ago #
  2. dynamitharry

    ok, so i totally tried to overdo it. i found out it was much more simple to do it like this.

    function div_in_side() { ?>
    <div class="sidebar">
    <?php }
    add_action('thematic_abovemainasides', 'div_in_side');
    function div_underside_side() { ?>
    <?php }
    add_action('thematic_belowmainasides', 'div_underside_side');

    and then i can put a div before the "#secondary" or "#primary" div.. thematic is pretty awsome!

    Posted 8 years ago #
  3. Minimalist

    Hi. This is what I have been looking for. But I do not know how to use this function you posted here. Can you please explain to me how to place a div ("primary-inside") inside the "primary" div and use it? I hope you can answer. Thanks!!

    Posted 7 years ago #
  4. proto

    Hello Minimalist,

    I suspect that dynamiharry may have put the code in the child theme's "functions.php" file. I hope you're using a child theme for your website (more info on it here if not why you should (if you are already using a child theme, just skip that link) :)

    If you don't yet have a child them "functions.php" file you can create a new one, just name it functions.php (or see the Thematic sample child theme that comes with pre made one in the download of thematic). An Open PHP tag will look like this:


    add the following code after it and it should work fine:

    //Function that creates the opening DIV tag above the Main Asides
    function webmagic_divabove_sideopen() {
    	echo ('<div id="yournewdivname">')
    add_action ('thematic_abovemainasides' , 'webmagic_divabove_sideopen');
    //Function that creates the closing DIV tag below the Main Asides
    function webmagic_divbelow_sideclose() {
    	echo ('</div><!-- This is the end of Your New Div -->')
    add_action ('thematic_belowmainasides' , 'webmagic_divbelow_sideclose');

    There are plenty of people more experienced than me on here who are brilliant and may have other suggestions but I tested the code above and it worked fine! Note, what the above is doing in simple terms is Thematic has been cleverly designed like a wall with velcro hooks on it in key places in the website. The code says take what I put in my echo statement and attach it to one of Thematic's velcro hooks, in this case we are targeting the hooks that are helpfully called thematic_abovemainasides or thematic_belowmainasides.

    Others on here may have other thoughts or advice but that's my take on it!

    Posted 7 years ago #
  5. velcro... i like the analogy, proto. i usually use a parking lot as mine.

    Posted 7 years ago #
  6. proto

    Ahahah! I like the parking lot one! Very good Helga! :)

    BTW - Minimalist, Helga is a bit of a legend around here, she's helped me out of many scrapes!

    I don't want to be so anoymous (get the facepalm ready) I've gone to edit my profile and add an image to my avatar (it's about time I revealed myself!!!) where's the option hiding? I checked the edit profile section (I told you it was a falepalmage moment!!) I want to reveal my identity (*gasps from the gallows when I reveals myself*)

    Posted 7 years ago #
  7. proto

    I'm back... I'm searching for a GRAVATAR and my true identity will be revealed although not as proto as apparently that name's taken!

    Minimalist - I hope it worked ok for you...

    Posted 7 years ago #
  8. parking lot wasn't mine originally. it was Kwight's. but i think it's great and you can extend it to cover filters too. which i did:

    lol... between two of the recent posts i am a ninja legend. i really just stay for the flattery (and the marriage proposals).

    to get a photo your forum email must be linked to

    Posted 7 years ago #
  9. pixelwoo


    I like analogies that are versatile!

    I finally got an image up! Hurray! Thanks ninja/legend :)

    Posted 7 years ago #
  10. Minimalist

    Thank you very much, proto!

    I will try to use your code. Thanks again.

    Posted 7 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.