August 7, 201214 yr Right, bit of a toughie here, I am completely stuck. I have a website here: http://universitycompare.com/university-guide/anglia-ruskin-university/ This website has an advertisement plug-in that assigns a different sidebar per page and pulls in each Ad, lovely plug-in! Works like a charm! I have one template, for each university profile page, and I have currently 100 universities, and I will be making 100 sidebars to go on each page, so they can have custom ads on each page. How would I pull in a different sidebar per page instead of making 100 templates for the universities, which is a long process that I don't want to go through! My ideal scenario would be to have a bit of code that can work out the page id and then I can name each sidebar based on the page id and then pull in that sidebar? - if that makes sense. P.S I am really in the deep end here and no idea where to start - any help is help!
August 13, 201213 yr This is one way of doing it but would still require different sidebar.php files in the same way as creating different templates, but at least you could shove them in a sub folder that way. <?php if (in_category('20')) {include (TEMPLATEPATH . '/sidebar2.php'); } else { include (TEMPLATEPATH . '/sidebar1.php'); } ?>
Create an account or sign in to comment