Editing the Loop to Exclude a Tag
-
Hello,
I am having some trouble editing my WP homepage loop. Currently, I have a custom post type called woo_video and on my homepage it shows my latest 9 video posts. However, I would like to add the ability to an exclude a video I post from the homepage (perhaps by tagging it something like “skip home”). However, I would still like it to show in the video categories that it was placed in. My code is as follows:
<!-- Start the Loop. --> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <!-- PHP Post Code Below. --> <?php echo '<div class="home-videos">'; $args = array( 'post_type' => 'woo_video', 'posts_per_page' => 9 ); $loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post(); echo '<div class="home-post">'; echo '<div class="home-post-thumbnail">'; if ( $woo_options['woo_post_content'] != 'content' ) { echo '<a href="' . get_permalink( get_the_ID() ) . '" rel="bookmark" title="' . the_title_attribute( array( 'echo' => 0 ) ) . '">' . woo_image_vimeo('meta=' . the_title_attribute( array( 'echo' => 0 ) ) . '&width=310&height=' . $woo_options['woo_thumb_h'] . '&class=thumbnail&link=img&return=true') . '</a>'; } echo '</div>'; echo '<div class="home-post-title">'; echo get_the_title($ID); echo '</div>'; echo '</div>'; endwhile; echo '</div>'; ?> <!-- End the Loop. --> <?php endwhile; else: ?> <p><?php _e('Sorry, no posts matched your criteria.'); ?></p> <?php endif; ?> <!-- End. -->
It is probably an easy fix but I can’t seem to get it to work. I appreciate your help!
Thank you!
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Editing the Loop to Exclude a Tag’ is closed to new replies.