PHP switch in wordpress?
-
So ive got 2 sidebars on the main page on this site (www.sikcyde.com), “sidebar.php”, and “sidebar2.php”. I have created additional sidebars for every other page I’ve created on the site. I want it so when you go to the page called “Mr. Liqz” it will load “liqzside.php” instead of “sidebar.php”(Which is the sidebar on the right side). So far with the switch I have this:
<?php $page_title="sikcyde"; switch ($page_title) { case "Mr. Liqz": include("liqzside.php"); break; case "Nige": include("nigeside.php"); break; case "Big Shot": include("bigshotside.php"); break; default: include("sidebar.php"); } ?>
The only part of the code that works is:
default: include("sidebar.php");
If I change “sidebar.php” to “liqzside.php” it will load liqzside.php for EVERY page I have, and the same goes if I replace it with nigeside.php and all other sidebars I have. I know I messed up somehow, but I don’t completely understand where I went wrong as I followed instructions from W3’s website about switches. Only thing I think would be wrong would be the case line, but I’m not sure how to fix that
Any tips or ideas on how to fix that?
Thanks for any suggestions ??
- The topic ‘PHP switch in wordpress?’ is closed to new replies.