I create a copy of the page:
<?php /** * Template Name: Gallery Page - Default * */ get_header(); ?> <main class="main__content"> <?php if ( has_post_format( 'image' ) ) : while ( have_posts() ) : the_post(); ?> <figure class="gallery-image post__prew effect"> <a href="<?php echo wp_get_attachment_url( get_post_thumbnail_id( get_the_ID() ) ) ?>" class="post__prew-link fancy" title=""> <?php mytheme_post_thumbnail(); ?> </a> </figure> <?php endwhile; else : get_template_part( 'template-parts/content', 'none' ); endif; ?> </main> <?php get_footer(); ?> I am trying to display on this page only articles with image type:
... <?php if ( has_post_format( 'image' ) ) : ... But it displays the none page, i.e. condition does not work:
... get_template_part( 'template-parts/content', 'none' ); ... In a post (article) I set the type of the image .
How can I fix what I'm doing wrong?