Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
/**
* [travel_log_child_get_trip_single_banner_image Add Banner Image to Trip single]
* @return void
*/
function travel_log_child_get_trip_single_banner_image(){
if ( defined( 'WP_TRAVEL_POST_TYPE' ) ) {
if ( is_singular( $post_types = WP_TRAVEL_POST_TYPE ) ) {
$bg_image = '';
if ( function_exists( 'wp_travel_get_post_thumbnail_url' ) ) {
$bg_image = wp_travel_get_post_thumbnail_url( get_queried_object_id(), 'large' );
?>
<style>
.custom-header {
background-image: url('<?php echo esc_url( $bg_image ) ?>');
background-size: cover;
}
</style>
<?php
}
}
}
}
add_action( 'wp_head', 'travel_log_child_get_trip_single_banner_image' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.