Skip to content

Instantly share code, notes, and snippets.

@jonathanfann
Created February 15, 2017 23:05
Show Gist options
  • Save jonathanfann/6e7fc5d49f23bdf284853fe210ec3ef9 to your computer and use it in GitHub Desktop.
Save jonathanfann/6e7fc5d49f23bdf284853fe210ec3ef9 to your computer and use it in GitHub Desktop.
Include Different Header For Each Custom Post Type
<?php
$post_type = get_post_type( get_the_ID() );
get_template_part( 'headers/' . $post_type, 'header' );
?>
<!--
if your custom post type label is named 'support' for example
this will include the contents of 'yourtheme/headers/support-header.php'
Note: Fails silently so if file doesn't exist, nothing will be included.
-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment