Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Alexander-Pop/16bc1498e0c0b0810dc8c820a6aea023 to your computer and use it in GitHub Desktop.
Save Alexander-Pop/16bc1498e0c0b0810dc8c820a6aea023 to your computer and use it in GitHub Desktop.
Drupal 8 - Removing the Default Drupal Page Title per content type #drupal8
<?php
use Drupal\node\Entity\Node;
function YOURTHEME_preprocess_page(&$variables) {
if (isset($node) && $node instanceof Node) {
// Create variable out of the current node type
$node_type = $node->getType();
// Remove page title block.
if (($node_type == 'you_content_type_system_name') || ($node_type == 'you_other_content_type_system_name')) {
unset($variables['page']['content']['YOURTHEME_page_title']);
}
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment