Exclude unattached image from media_category archive
-
Currently media category archives showing all images including unattached. I want to exclude unattached images from category archives.
Here is the template of my archive page-<?php /** * The template for displaying Archive pages */ get_header(); ?> <section id="primary" class="site-content"> <div id="content" role="main"> <?php if (have_posts()) : ?> <?php while ( have_posts() ) : the_post(); ?> <article id="post-<?php the_ID(); ?>" <?php post_class( 'image-attachment' ); ?>> <div class="excerpt-wrapper"><!-- Excerpt --> <header class="entry-header"> <h2 class="entry-title"><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h2> </header> <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" rel="attachment" > <?php $attachment_size = apply_filters( 'bosome_attachment_size', array( 750, 750 ) ); echo wp_get_attachment_image( $post->ID, $attachment_size ); ?></a> </div> </article> <?php endwhile; ?> <?php bosome_content_nav(); ?> <?php else : ?> <?php get_template_part( 'content', 'none' ); ?> <?php endif; ?> </div> </section> <?php get_sidebar(); ?> <?php get_footer(); ?>
Thanks in advance.
- The topic ‘Exclude unattached image from media_category archive’ is closed to new replies.