Snippets: Add New Custom Page Header Title Style to Page Settings

If you want a unique page header for a specific page(s) and you don't like any of the preset page header title styles you could easily add a new style via your child theme that you can select and control the exact output and styling.

The first function in this example add a new style named "My Custom Style" with the ID "my-custom-style-id" (you should change these to something that makes more sense for what you are doing)."

In the second function we are setting the default page header to "disabled" if the custom page header style is selected so we can control the output.

In the last function we are inserting our own custom code for the "my-custom-style-id" page header style. The example adds the "Secondary Image", the title and the subheading into your custom page header. You can remove/add anything here. Alternatively you could use the do_shortcode function and the templatera shortcode if you wanted to create this custom header output via a templatera template using the WPBakery template (See example here or other builder such as Elementor via their own functions.

Last you will want to write up some custom CSS to make your new custom page header title look good.

View snippet hosted on Gist here.

Snippet hosted on Gist here: https://gist.github.com/wpexplorer/d6b84850e24814d3c506036293bbaf5a (CloudFlare was blocking this snippet for some reason so I couldn't add it to my site, will be fixing shortly)
All PHP snippets should be added via a child theme's functions.php file.