Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- p2p_register_connection_type( array(
- 'name' => 'posts_to_invitations',
- 'from' => 'post',
- 'to' => 'invitations',
- 'sortable' => 'any',
- 'admin_dropdown' => 'from',
- 'admin_column' => 'from',
- 'fields' => array(
- 'couples' => array(
- 'title' => 'Couples',
- 'type' => 'checkbox'
- ),
- 'going' => array(
- 'title' => '# Going',
- 'type' => 'select',
- 'values' => array( 'No Response','Not Going', '1', '2', '3', '4', '5', '6', '7', '8' )
- ),
- 'attend' => array(
- 'title' => '# Attend',
- 'type' => 'select',
- 'values' => array( 'Not Attending', '1', '2', '3', '4', '5', '6', '7', '8' )
- ),
- 'comments' => array(
- 'title' => 'Comments',
- 'type' => 'text',
- ),
- 'table' => array(
- 'title' => '# Table',
- 'type' => 'select',
- 'values' => array('01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '50' )
- ),
- )
- ) );
- // Find connected pages
- $connected = new WP_Query( array(
- 'connected_type' => 'posts_to_invitations',
- 'connected_items' => get_queried_object(),
- 'nopaging' => true,
- ) );
- // Display connected pages
- if ( $connected->have_posts() ) :
- ?>
- <h3>Related pages:</h3>
- <ul>
- <?php while ( $connected->have_posts() ) : $connected->the_post(); ?>
- <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
- <?php endwhile; ?>
- </ul>
- <?php
- // Prevent weirdness
- wp_reset_postdata();
- endif;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement