Skip to content

Instantly share code, notes, and snippets.

@frontend-coder
Last active August 3, 2022 12:33
Show Gist options
  • Save frontend-coder/3219244642083b1c00ccb6eda3e82282 to your computer and use it in GitHub Desktop.
Save frontend-coder/3219244642083b1c00ccb6eda3e82282 to your computer and use it in GitHub Desktop.
44. Вивід постів в single в залежності від формата постів #wordpress
<?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