0

I want to add a CSS class to a particular block. I am using the module Block Class for it as shown in block_class module. I am able to enable the module and assign the class by going to structures/block/configure. I am facing problem in where to add the php snippet. I am using a Zen starter kit theme and have copied the block.tpl.php from Zen/templates to my theme/templates and added the lines as specified...

Here's what my code looks like:

Before:

<div id="<?php print $block_html_id; ?>" 
class="<?php print $classes;   ?>"
<?php print $attributes; ?>>

After:

<div id="<?php print $block_html_id; ?>" 
class="<?php print $classes; ?> **<?php print block_class($block);** ?>"
<?php print $attributes; ?>>
  • version d6 or d7? – monymirza Jan 30 '13 at 10:02
  • I am using version 7 – why Jan 30 '13 at 10:49
1

As far as I know, you don't have to add any code to use the class you set on structure/block/configure. The class should be automatically added to $classes array.

  • even i thought so but when i am inspecting the element its not showing...i have cleared all cache also – why Jan 30 '13 at 10:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.