Advertisement
Guest User

posts_2_posts output issue

a guest
Sep 26th, 2012
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php get_header(); ?>
  2.    
  3.     <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
  4.    
  5.         <?php
  6.        
  7.             $connected = new WP_Query( array(
  8.               'connected_type' => 'projects_to_projects',
  9.               'connected_items' => get_queried_object(),
  10.               'nopaging' => true
  11.             ) );
  12.            
  13.             echo 'This is where related posts should start displaying.<br />';
  14.            
  15.             // Display connected pages
  16.             if ( $connected->have_posts() ) {
  17.            
  18.                 echo 'I am inside the loop and I worked.';
  19.  
  20.                 echo '<ul class="group">';
  21.                     while ( $connected->have_posts() ) : $connected->the_post();
  22.                         echo '<li><h3 class="project-title">' . $post->post_title . '</h3></li>';
  23.                     endwhile;
  24.                 echo '</ul>';
  25.                
  26.                 // Prevent weirdness
  27.                 wp_reset_postdata();
  28.                
  29.             }
  30.            
  31.             echo 'This is where related posts should end displaying.<br />';
  32.            
  33.             //using custom dump function
  34.             dump($connected);
  35.  
  36.         ?>
  37.  
  38.     <?php endwhile; endif; ?>
  39.  
  40. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement