Skip to content

Instantly share code, notes, and snippets.

@klaasvw
Created September 10, 2012 09:32
Show Gist options
  • Save klaasvw/3689923 to your computer and use it in GitHub Desktop.
Save klaasvw/3689923 to your computer and use it in GitHub Desktop.
Hide a page title on a certain page view.
<?php
/**
* @file
* Hide the page title on a page view snippet.
*/
/**
* Implements template_process_page().
*
* Removes the regular page title from news pages.
*/
function via_news_process_page(&$variables) {
// Only hide the title on the view index page.
$view = views_get_page_view();
if ($view && $view->name == 'news' && $view->current_display == 'page_1') {
$variables['title'] = NULL;
}
}
@klaasvw
Copy link
Author

klaasvw commented Sep 10, 2012

I set the title to NULL instead of using unset to prevent undefined variable warnings from the system page.tpl.php.

@klaasvw
Copy link
Author

klaasvw commented Oct 13, 2013

Note that you can also use hook_page_build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment