Forums

Sidebar different for each section. (6 posts)

  1. piggsy1992
    Member
    Posted 9 months ago #

    I am making a fansite for Assassin's Creed using wordpress. I want a different sidebar for each section.

    So I have a default side for the home page, but then I want a sidebar for each section on the different games. Example:

    I have a sidebar for brotherhood, so every page that has example.com/brotherhood will have the brotherhood sidebar. Same goes for revelations and the others.

    I want to do this without a plugin.

  2. equalmark
    Member
    Posted 9 months ago #

    Take a look here:

    http://codex.wordpress.org/Function_Reference/get_sidebar

    Particularly the muti sidebars part.

  3. piggsy1992
    Member
    Posted 9 months ago #

    I figured another way. Don't if it is a correct way. I created different sidebar files, such as: sidebar-brotherhood.php, sidebar-revelations.php. Then I created different page templates like brotherhood.php, so I can choose a certain template when I post a page. In each template page I matched the sidebars accordingly, for example in the brothhood.php I put <?php get_sidebar('brotherhood'); ?>.

    Is this correct or is the other way (which I don't get) correct?

  4. Len
    Member
    Posted 9 months ago #

    Hi piggsy1992

    Your approach is fine. You can use conditionals as outlined by the Codex in the link given you by equalmark or you can create Page Templates which utilize file includes (as you have done)

    Either method is fine.

  5. piggsy1992
    Member
    Posted 9 months ago #

    Thank you for confirming that Len. Also thanks to equalmark. You both have been a great help.

  6. Len
    Member
    Posted 9 months ago #

    You're welcome. Good luck with the site.

Reply

You must log in to post.

About this Topic

Tags

No tags yet.