Best Method – Dependent Sidebar by Post
-
Hi,
I need to have dependent sidebars per group of posts. I.E. I have posts 21-40 that need one sidebar and 41-60 that need another. The best way I’ve figured out to do this is by this code example:
if (is_single(27)) {include(TEMPLATEPATH."/rookiebottombar.php");} elseif (is_single(28)) {include(TEMPLATEPATH."/rookiebottombar.php");} elseif (is_single(29)) {include(TEMPLATEPATH."/rookiebottombar.php");} elseif (is_single(30)) {include(TEMPLATEPATH."/rookiebottombar.php");} elseif (is_single(38)) {include(TEMPLATEPATH."/rookiebottombar.php");} elseif (is_single(39)) {include(TEMPLATEPATH."/rookiebottombar.php");} elseif (is_single(40)) {include(TEMPLATEPATH."/rookiebottombar.php");} elseif (is_single(41)) {include(TEMPLATEPATH."/rookiebottombar.php");} elseif (is_single(42)) {include(TEMPLATEPATH."/rookiebottombar.php");} elseif (is_single(43)) {include(TEMPLATEPATH."/rookiebottombar.php");} elseif (is_single(44)) {include(TEMPLATEPATH."/rookiebottombar.php");} elseif (is_single(45)) {include(TEMPLATEPATH."/rookiebottombar.php");} elseif (is_single(46)) {include(TEMPLATEPATH."/rookiebottombar.php");} elseif (is_single(47)) {include(TEMPLATEPATH."/rookiebottombar.php");} elseif (is_single(48)) {include(TEMPLATEPATH."/rookiebottombar.php");} else ; ?>
But multiple that by 5 times the number of posts and it is way to much processing. Also, should I add breaks between each of these?
If you can let me know your recommendations for optimizing this kind of code.
Kindly,
Michael
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Best Method – Dependent Sidebar by Post’ is closed to new replies.