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.
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?
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.
piggsy1992
Member
Posted 9 months ago #
Thank you for confirming that Len. Also thanks to equalmark. You both have been a great help.
You're welcome. Good luck with the site.