Skip to:

show sidebar on single post pages?

  • Hello,

    How can I make the sidebar show up on single post pages?
    I added get_sidebar to the single.php, but the sidebar shows up below the page and not in its place.
    Thanks in advance

Viewing 13 replies - 1 through 13 (of 13 total)
  • This is a theming issue and more specifically – by the sounds of things – a CSS one, but could simply be that the sidebar is trying to render in an incorrect section of the page.

    I’m afraid that you would need to supply a lot more detail than you have in order that someone could help, at the moment it’s a ‘How long is a piece of string’ type question.

    Tell us the theme your using and as much detail pertaining to type of install and version numbers and preferably a link to the site so that the issue may be observed.

    I am using bp latest version on latest version wp. theme is bp default, the site address is irrelevant as it is a production site, and the get_sidebar is not enabled at the moment, but you can check out anyway

    I tried including get_sidebar function in div ids like sidebar or left sidebar, but no luck. Also I tried to edit the content div as narrowcollumn- my idea is that the sidebar doesnt show up because of the width of the content, as it simply does not have enough space to be there…

    You must validate the page CSS can not correctly parse the DOM / markup and know where to attach it’s rules to when there are markup errors.

    You have non legal characters as literals, probably from copy pasting. Run through the major elements token identifiers and make sure they are all correct and proper “” marks

    With that corrected you should find that your rulesets now can apply themselves to elements or tokens which they can recognise

    can you please explain in english? I did not understand most of what you said..

    Look at your IDs and classes, backspace out the existing quote marks and replace using your keyboard characters ” ” what you have at the moment is incorrect and due somewhere to copy and pasting characters outside the permitted character set, the sort of horror that Word places in markup if not careful :)

    Here is default buddypress theme css-
    Here is the single.php

    what exactly do I need to edit??

    :) explained in last comment.

    Look at that code, specifically look at the classes and the id’s on various elements such as the sidebar where the value needs to be quoted it needs to be plain quote marks as your keyboard will enter. At the moment the quote marks are not correct character entities they are angled .

    Check the code you posted to pastebin, I have edited the first quote mark of the class on the element ‘content’ to show you a visual comparison of the two different marks – compare to the sidebar element at bottom of page:

    I don’t claim this is definitely going to cure the issue but it is a problem for correctly behaving browsers and needs to be put right before moving on to look at other possible causes – if the isue still persists

    Yeah, I edited them, now there is a divider between content and the place the sidebar should be at, but still no sidebar, although the code for the sidebar is the same as the index.php that has the sidebar.

    Hardcode something in the sidebar just to be sure it ought to be displaying something or not simply hidden due to not having widgets.

    Compare the two pages index and single post, you are not calling the same sidebars; in single.php you appear to be calling ‘left-sidebar.php’ and this does not have the same rules applied to it as does ‘sidebar.php, and would need to if it were to function in the same manner as on the index page.

    Not sure where you got ‘left-sidebar.php’ as it doesn’t appear as part of the bp-default files.

    Oh and lastly the sidebar is not being called into the correct position, again compare the two pages, in index.php ‘sidebar’ is called just before #content closes and in single.php you are calling it after #container closes and the comment after #container states

    You just need to be careful when moving page elements around in templates and check carefully that they are in the correct position as on other pages.

    So decide what sidebar you need to call if it is that left-sidebar then you will need to give it the same rules as the #sidebar, add the #sidebar-left id to the #sidebar ruleset in default.css. however this is simply a unnecessary extra div around an #sidebar so I would lose it altogether then you shouldn’t need to adjust the CSS, much better though is to call the same sidebar as the index.php (the locate_template call) and lastly you need to ensure that the sidebar is called into the same position before #content closes.

    Thank you for your help! The problem was that the sidebar was called out after content, the same as the index.php, but somehow it happen to be working on index.php. so I edited them both and now sidebar is showing up on single post pages.
    I will try to contribute myself too.

    Yes the problems were multiple and as I described earlier :) Glad it’s working now, just take extra care when chopping templates around and with what I suspect is a mixture of theme files?

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘show sidebar on single post pages?’ is closed to new replies.
Skip to toolbar