ThemeShaper Forums » Thematic


Inserting divs into div#content

(3 posts)
  • Started 8 years ago by lama
  • Latest reply from lama
  • This topic is not resolved
  1. lama

    I need to insert two divs into div#content, so it looks like this:

    <div id="content">
        <div id="inserted_top">some stuff</div>
        actual thematic_content
        <div id="inserted_bottom">some more stuff</div>

    I can edit page.php file just fine, but I wanted to have all the modifications in my functions.php. Since my knowledge of php is nonexistent, could anyone help me?

    Thanks in advance.

    Posted 8 years ago #
  2. I use this little snippet.

    function quick_div() {
    <div class="any-class">

    This will insert a div with "any-class" to the hook "thematic_abovecontent", if you don't know what hooks are, take a look at Visualizing Thematic real quick. The hooks you are looking for are thematic_belowcontent and thematic_abovecontent (which is the above snippet). You will need to duplicate this snippet twice, change the name from quick_div in both spots to something unique for each snippet. :)

    Posted 8 years ago #
  3. lama

    Many thanks ScottNix, but it's not exactly what I had in mind - maybe my explanation wasn't clear. Your solution works like a charm, but it adds the divs surrounding div#content so it looks like

    <div id="inserted_top">some content</div>
        <div id="content">...</div>
    <div id="inserted_bottom">some content</div>

    I need them inside, one right after the div#content beginning and another one right before its ending. I grasp the general idea of hooks and filters, but putting any kind of function together is far beyond my capabilities (as you may see below). Not that I haven't tried; the closest I got was (please don't laugh - I based my knowledge on examples and got no idea about php syntax)

    function additional_divs() {
        echo '<div>some content</div>';
        echo thematic_postheader_posttitle();
        echo thematic_content();
        echo '<div>some other content</div>';
    add_filter('thematic_content', 'additional_divs');

    It displays all the things I want, and also some I don't want to show up - thematic_postheader_posttitle and thematic_content are doubled, and I got no idea how to remove them.

    Posted 8 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.