Last active
August 3, 2022 12:33
-
-
Save frontend-coder/3219244642083b1c00ccb6eda3e82282 to your computer and use it in GitHub Desktop.
44. Вивід постів в single в залежності від формата постів #wordpress
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
<?php | |
if( get_the_post_thumbnail($post->ID, 'post-featured') ) { ?> | |
<div class="featured_image"> | |
<?php | |
$domain_post_format = get_post_format(); | |
if( $domain_post_format == 'video' ) { | |
echo get_the_post_thumbnail($post->ID, 'post-featured'); | |
get_template_part('partials/format/video'); | |
} elseif( $domain_post_format == 'gallery' ) { | |
get_template_part('partials/format/gallery', '', 'post-featured'); | |
} else { | |
if(!empty($args['featured_image'])) { | |
echo '<div class="featured_image_holder"><a href=" '.esc_url(get_the_permalink()); .' "> '; | |
echo get_the_post_thumbnail($post->ID, $args['featured_image'] ); | |
echo '</a></div>'; | |
} | |
} | |
?> | |
</div> | |
<?php | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment