0

function dtwd_special_show_rel_posts($atts){
ob_start(); ?>
 <?php
 $args=array(
'post_type' => 'project',		
'post__not_in' => array(get_the_ID()),
'posts_per_page'=>3, 
);
 $my_query = new wp_query( $args );
while( $my_query->have_posts() ) {
$my_query->the_post();
?>
 <div class="related-thumb">
<a rel="external" href="<? the_permalink()?>"><?php the_post_thumbnail(); ?><br />
<?php the_title(); ?>
</a>
 </div>
<?php }
wp_reset_query();
?>
<?php $specialsearch = ob_get_clean();
return $specialsearch;
}
add_shortcode('show_rel_posts', 'dtwd_special_show_rel_posts');

Jagdish Sarma Asked question September 27, 2021
Add a Comment