Transparent Header for Custom Post Types

If you’re adding full-width and parallax featured images to your custom post types, you may also find yourself wanting to apply a transparent header to these posts, as well.

Similarly to how we added the meta boxes to the Edit Post screen of our custom post types in the last article, we need to do that here. So, we’ll just need to filter the setup arguments of the “Theme Layout” meta box so that it appears there.

However in this case, on the front-end of the website, the theme simply looks for the meta data existing to apply the transparent header. In other words, if we have the meta box in the admin to select the option, the front-end will automatically apply the setting without any extra work. So this makes our custom code a little simpler than the previous article.

 * Display "Theme Layout" meta box when
 * editing custom post types, foo and bar.
function my_layout_meta( $setup ) {

    $setup['config']['page'][] = 'foo';
    $setup['config']['page'][] = 'bar';

    return $setup;
add_filter('themeblvd_layout_meta', 'my_layout_meta');