1

I've been tasked with maintaining a site I didn't make and I don't have access to the original developers.

The site is built with a custom zen theme. The block that I'm interested in is listed in the disabled section of blocks and is configured to the "None" region of the enabled themes and is set to be displayed on all pages with no restriction for users or content types. There doesn't appear to be any obvious settings in the page that the block is on or in the block itself that would determine it's placement. So, I'm a little lost as to how to proceed. Any advice would be appreciated.

1

Add the following function in your template.php

function THEMENAME_render_block($module, $delta, array $options = array()){
  $default_options = array(
    'title' => '<none>',
    'region' => -1,
  );

  $options = array_merge($default_options, $options);

  $block = db_query('SELECT * FROM {block} WHERE module = :module AND delta = :delta', array(':module' => $module, ':delta' => $delta))->fetchObject();
  if($block) {
    $block = block_load($module, $delta);
    $block->title = $options['title'];
    $block->region = $options['region'];
    $blocks = array($block);
    $rblocks = _block_render_blocks($blocks);
    $render_array = _block_get_renderable_array($rblocks);
    return drupal_render($render_array);
  }
  return "";
}

then in your tpl file of your specific page/node

<?php print THEMENAME_render_block('<moduleName>', 'delta', array('title' => t('Block Title'))); ?>

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.