• Resolved juzkyte

    (@juzkyte)


    <?php
    $posttags = get_the_tags();
    if ($posttags) {$dem= 0; foreach($posttags as $tag) {$dstag[$dem]= $tag->term_id; $dem++;}}
    $args = array('tag__in' => $dstag);
    $the_query = new WP_Query( $args );  ?>
    
    <?php if ( $the_query->have_posts() ) : ?>
    
    <!-- pagination here -->
    
    	<!-- the loop -->
    	<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
    	<h2><?php the_title(); ?></h2>
    	<?php endwhile; ?>
    	<!-- end of the loop -->
    
    <!-- pagination here -->
    
    <?php wp_reset_postdata(); ?>
    
    <?php else: ?>
    	<p><?php _e( 'Sorry, no posts matched your criteria.' ); ?></p>
    <?php endif; ?>

    I used this code, worked but…
    This code will show posts from tags of current post… but, it show current post… Please help me except current post ??

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Show posts from tags of current post but don't show current post’ is closed to new replies.