Created
March 2, 2018 05:36
-
-
Save anonymous/d57b71b78bade2892db1fc1bad40a588 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* [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