Skip to content

Instantly share code, notes, and snippets.

@SuryawanshiPrajakta
Created July 11, 2020 06:33
Show Gist options
  • Save SuryawanshiPrajakta/3f636d17dcd8db44e9b12cd76f7725e9 to your computer and use it in GitHub Desktop.
Save SuryawanshiPrajakta/3f636d17dcd8db44e9b12cd76f7725e9 to your computer and use it in GitHub Desktop.
Show video instead of thumbnail
1) Create ACF field - oEmbed and attach to the Posts
2) Add the below code in active child them's functions.php
function single_post_thumb_before( $post_id, $settings ) {
?>
<div class="custom uael-post__thumbnail">
<?php echo get_field( 'posts_video_thumbnail', $post_id ); ?>
</div>
<?php
}
add_action( 'uael_single_post_before_thumbnail', 'single_post_thumb_before', 10, 2 );
Note - Please replace the 'posts_video_thumbnail' wit the ID of your custom field.
3) Add the below CSS -
.uael-post__thumbnail{
display: none;
}
.custom.uael-post__thumbnail{
display: block;
}
4) This will show the Video at the Posts thumbnail - https://cl.ly/7a9905f3caed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment