Deepti Kakade
Deepti Kakade

Reputation: 3203

How to hide particular region of page from view in Drupal 7

I have a one view and i have not created a template for that view. So its loading default page template. I want to hide a one region of that page from that view. I know I can handle that from admin end but I don't want. I want to hide that region from code. So for that I have written theme_preprocess_views_view

function mytheme_preprocess_views_view(&$vars) {
    if ($vars['view']->name == "blog_api" && $vars['view']->current_display == "page_1") {
    $vars['nav'] = array();
    }
}

I have added this preprocessor in template.php of my theme. But its not hiding my region, can you give suggestion how to implement this in Drupal 7

Upvotes: 0

Views: 170

Answers (2)

Sumit
Sumit

Reputation: 103

You can use preprocess page like this in you template.php to hide the particular region from any page.

function theme_preprocess_page(&$vars) {
   unset($vars['page']['region_name']);
 }

Upvotes: 2

JSunny
JSunny

Reputation: 477

Try adding your hook function in module, and clear the cache that may help.

Upvotes: -1

Related Questions