• Hi,

    I was just wondering whether anyone could help me with this little problem I’m stuck with.

    I would like to move the Widget Area (#secondary) out of the Primary Div so that it can float alongside the main content to the right,rather than being wrapped inside the main content.

    Can anyone help with the best way to approach this?

    Thanks

Viewing 7 replies - 16 through 22 (of 22 total)
  • Thread Starter Wolfman1000

    (@wolfman1000)

    #Alchymyth

    You seem to present yourself as having an understanding of this but seem intent on not actually revealing the methodology behind solving the actual problem at hand.Which seems a bit of a shame.

    I already have mentioned the way to look at it:
    – consider how and when the sub-files like header.php, sidebar.php, and footer.php are called for example in index.php
    – make kind of a collage so you end up with one full html structure as you would find for example when you view the html in the browser.

    this should enable you to see that closing the #main div, within index.php (and within the other main template files, and remove the closing div from footer.php should give you the wanted change of the html, i.e. move #secondary out of #main.

    in more details –
    rough structure of the important divs, for example of index.php:

    index.php before changes:

    start of index.php
    
    call get_header()
    start of header.php
    === <body>
    === <div id="page" class="hfeed">
    === <div id="main">
    end of header.php
    
    <div id="primary"></div><!-- #primary -->
    
    call get_sidebar()
    === <div id="secondary" class="widget-area" role="complementary">
    === </div><!-- #secondary .widget-area -->
    end of sidebar.php
    
    call get_footer()
    === </div><!-- #main -->
    === <footer id="colophon" role="contentinfo">
    === </footer><!-- #colophon -->
    === </div><!-- #page -->
    === </body>
    end of footer.php
    
    end of index.php

    index.php after changes:

    start of (edited) index.php
    
    call get_header()
    start of header.php
    === <body>
    === <div id="page" class="hfeed">
    === <div id="main">
    end of header.php
    
    <div id="primary"></div><!-- #primary -->
    <em>=== </div><!-- #main -->[<strong>this line is now added here</strong>]</em>
    
    call get_sidebar()
    === <div id="secondary" class="widget-area" role="complementary">
    === </div><!-- #secondary .widget-area -->
    end of sidebar.php
    
    call get_footer()
    <em>=== </div><!-- #main -->[<strong>this line is now removed</strong>]</em>
    === <footer id="colophon" role="contentinfo">
    === </footer><!-- #colophon -->
    === </div><!-- #page -->
    === </body>
    end of footer.php
    
    end of (edited) index.php

    and of course you need to do the same with the other templates.

    Thread Starter Wolfman1000

    (@wolfman1000)

    Thanks Alchymyth.

    That’s a lot more helpful and insightful.As I mentioned I’m not really well versed in PHP at all so this information gives me a lot better understanding of how the final code is constructed.

    From what I can gather,the ‘call’ function in index then ‘pulls in’ the relevant PHP file containing the html code and whatever order these ‘calls’ are in will determine the eventual hierarchy of the combined code.Would this assumption be correct?

    correct.

    the ‘get_whatever()’ call kind-of slots the file into the location whrer it gets called; this is like assembling a larger structure out of small bits (plus executing all php functions) … the end result is the html as you see it in the browser.

    Thread Starter Wolfman1000

    (@wolfman1000)

    Thanks a lot for this,it’s a lot clearer now.

    I think I’ve managed to remove it from #main now.

    Any chance you could have a quick look and see if I’ve managed to do it correctly?Would be much appreciated.

    the html structure seems to be changed the way you intended – but only for the posts page (based on index.php);
    you will also need to edit single.php, page.php, archive.php, author.php, category.php, image.php, search.php, and tag.php.

    your site also has some validation errors – https://validator.w3.org/check?uri=http%3A%2F%2Fwww.braveandboldindustries.com%2Fblog%2F&charset=%28detect+automatically%29&doctype=Inline&group=0
    https://codex.www.ads-software.com/Validating_a_Website

    Thread Starter Wolfman1000

    (@wolfman1000)

    Thanks very much my man,as I say the help is very much appreciated as this was starting to get quite frustrating!

    I noticed that things were going a bit wierd when I changed page etc,this must be the cause.

    Yes I’m going to slowly work my way through the validation errors when I get this sorted.

    The idea is that the sidebar will scroll with the content.I installed the Q2W3 plugin to do this but it doesn’t seem to work at the moment.Probably need to fix everything else first eh?

    I’m also using Ajax on the site so that the SOundcloud widget in the Sidebar doesnt keep refreshing everytime you navigate to a new page.This has worked nicely,however it has made the rollover/focus on the Nav menu not work correctly as it doesn’t display the current page you are on.

Viewing 7 replies - 16 through 22 (of 22 total)
  • The topic ‘Moving Widget Sidebar out of Primary Div’ is closed to new replies.