Skip to content

Instantly share code, notes, and snippets.

@wpexplorer
Created November 4, 2019 19:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wpexplorer/d6b84850e24814d3c506036293bbaf5a to your computer and use it in GitHub Desktop.
Save wpexplorer/d6b84850e24814d3c506036293bbaf5a to your computer and use it in GitHub Desktop.
// Add new title style
add_filter( 'wpex_title_styles', function( $styles ) {
$styles['my-custom-style-id'] = 'My Custom Style';
return $styles;
} );
// Disable default tile when using "background-style-2"
add_filter( 'wpex_display_page_header', function( $enabled ) {
if ( function_exists( 'wpex_page_header_style' ) && 'my-custom-style-id' == wpex_page_header_style() ) {
return false;
}
return $enabled;
} );
// Add our own custom title template
add_action( 'wpex_hook_main_top', function() {
if ( function_exists( 'wpex_page_header_style' ) && 'my-custom-style-id' == wpex_page_header_style() ) { ?>
<div class="my-custom-page-header-class">
<div class="container">
<?php
// Show custom image
if ( $secondary_image = get_post_meta( get_the_ID(), 'wpex_secondary_thumbnail', true ) ) {
echo '<div class="my-custom-page-header-class-img"><img src="' . esc_url( wp_get_attachment_url( $secondary_image ) ) . '"></div>';
} ?>
<?php
// Show title
if ( function_exists( 'wpex_get_template_part' ) ) { wpex_get_template_part( 'page_header_title' ); } ?>
<?php
// Show Subheading
if ( function_exists( 'wpex_get_template_part' ) ) { wpex_get_template_part( 'page_header_subheading' ); } ?>
</div>
</div>
<?php }
}, 15 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment