I would like to add a around a menu block I am displaying on a section of my site to style it differently on a certain page only.
How do I do this? Can I target a certain page with a conditional somehow?
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.Sign up to join this community
First, get fully familiar with Template Suggestions (here is a good reference) then
A. copy block.tpl.php to your theme if it's not there already, and then,
B. copy it to block-MENU-DELTA.tpl.php where MENU-DELTA is the correct incantation of menu and name/delta for your block, then,
C. Inside this new template, put in some logic that does whatever differently based upon what page you are looking at. Easiest is to do wrap your html in an
if keyed off $_GET['q'], eg, something like:
<?php if ($_GET['q']=='page/we/are/looking/for'): ?> // custom html here <?php else: ?> // regular html here <?php endif; ?>