Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function show_directory() {
- $args = array(
- 'post_status' => 'publish',
- 'post_type' => 'directory',
- 'meta_key' => 'faculty_last',
- 'orderby' => 'meta_value',
- 'order' => 'asc',
- 'posts_per_page' => -1,
- 'nopaging' => true,
- 'suppress_filters' => false,
- );
- $dir_query = new WP_Query($args);
- p2p_type( 'directory_to_projects' )->each_connected( $dir_query );
- if ($dir_query->have_posts()) : while ($dir_query->have_posts()) : $dir_query->the_post();
- global $post;
- // CONDITIONAL: IF THE DIRECTORY ITEM HAS A CONNECTION IN THE 'FROM' DIRECTION, AND THE CONNECTION TYPE IS DIRECTORY_TO_PROJECTS, DISPLAY IT
- if ( $post->connected && $post->connected[0]->p2p_from && ( $post->connected[0]->p2p_type == 'directory_to_projects' ) ) {
- the_title();
- p2p_type( 'directory_to_projects' )->each_connected( $dir_query );
- echo '<ul>';
- foreach ( $post->connected as $post ) : setup_postdata( $post ); ?>
- <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
- <?php
- endforeach;
- echo '</ul>';
- wp_reset_postdata();
- } // end conditional
- endwhile;
- endif;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement