Choose Custom Header Type Template


This is a Developer Level doc.

If you're unfamiliar with PHP and/or editing files, codes and templates, as well as with resolving possible conflict, please seek help from a professional. Under our Support Policy, we don't provide support for modifications and customization.

By default, you are able to select the custom header type template from the Customizer or using the OceanWP Metabox Settings.

However, if you're using a custom PHP code to display the custom header type on categories, archives, CPTs and / or other website portions not covered by OceanWP Metabox Settings, you can still display the selected custom header template created via OceanWP > My Library.

To select the correct custom template for the Custom Header type, you can use the following PHP snippet:

// Choose correct custom template for the Custom Header type.
function my_homepage_header_template( $template ) {
// Return the custom header template id.
if ( is_front_page() ) {
$template = 1435;
}
// Return.
return $template;
}
add_filter( 'ocean_custom_header_template', 'my_homepage_header_template' );

Replace 1435 from the $template variable with the actual ID of your custom template.

All PHP snippets should be added via a child theme's functions.php file.

Additional useful links:

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.