Support » Themes and Templates » Help needed adding a sidebar to the pages!

  • Hey guys,

    I’m looking to insert a sidebar that sits on the right of my pages but I’m having some trouble with it.

    I Googled a tutorial and found this;

    I got through the first two steps fine but the third rather confused me a little.

    I’ve uploaded the homepage-sidebar.php file to where all the other .php files sit for the template but I have no idea where I’m meant to be inserting the code below?

    <?php get_sidebar('homepage'); ?>

    Can anyone help me out here?

    Or is there an easier way to do what I’m trying to accomplish??

    Thanks guys.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Rename that homepage-sidebar.php into sidebar-homepage.php and after use this code
    <?php get_sidebar('homepage');?>

    hope its may work

    Hey Viky,

    Thanks for your response.

    Although I think you may have slightly misinterpreted what I’m trying to say.

    I don’t know where I’m meant to insert that code!



    Forum Moderator

    insert a sidebar that sits on the right of my pages

    the most likely template to insert the code is page.php, however the details depend on your currently used theme.

    I’m using the TwentyEleven theme.

    Just tried adding the code to the page.php but it put the sidebar below the content, rather than on the right side of the content.



    Forum Moderator

    before you make any customisations to the templates, strongly consider to create a child theme to work with – – it is not recommended to edit the default theme Twenty Eleven directly.
    one of the reason being, that any customisations will get overwritten when you upgrade the theme.

    Twenty Eleven comes with a page template with sidebar ‘Sidebar Template’;

    any new page template with a sidebar needs to have some body_classes corrected so the sidebar displays in the right location; I have written about this in my site:

    a link to your site might help with troubleshooting

    Hey Alchymyth,

    Thanks for your response.

    I have a Custom CSS plugin for the site which I presume acts as a child theme?

    Here is a link to the site I’m working on;

    What do you advise me to do here then?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Help needed adding a sidebar to the pages!’ is closed to new replies.