daily pastebin goal
4%
SHARE
TWEET

Untitled

a guest Feb 22nd, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $count=0;
  2.     $related = p2p_type($connected_type)->get_related( get_queried_object_id() );
  3.  
  4.             // Display related posts
  5.             if ( $related->have_posts() ) :
  6.             $count++;
  7.             while ( $related->have_posts() ) : $related->the_post();            
  8.         if ($count == 2) {
  9.  
  10.         echo the_title();  
  11.  
  12.         } else {
  13.  
  14.         echo 'this post won't show up';
  15.         }
  16.  
  17.     endwhile;
  18.  
  19.                 // Prevent weirdness
  20.             wp_reset_postdata();
  21.  
  22.             endif;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top