Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /* Posts 2 Posts v1.4.3 */
- /* function.php */
- function connection_types() {
- if ( !function_exists( 'p2p_register_connection_type' ) )
- return;
- p2p_register_connection_type( array(
- 'name' => 'posts_to_artists',
- 'from' => 'post',
- 'to' => 'artists',
- 'title' => array( 'from' => 'Connected Artists', 'to' => 'Connected Posts' )
- ) );
- p2p_register_connection_type( array(
- 'name' => 'posts_to_series',
- 'from' => 'post',
- 'to' => 'series',
- 'title' => array( 'from' => 'Connected Series', 'to' => 'Connected Posts' )
- ) );
- }
- add_action( 'p2p_init', 'connection_types' );
- ?>
- /* theme */
- <?php
- // Find connected pages
- $connected = new WP_Query( array(
- 'connected_type' => 'series_to_posts',
- 'connected_items' => get_queried_object(),
- 'posts_per_page'=>3, // Enter the Number of posts that will be shown.
- ) );
- // Display connected pages
- if ( $connected->have_posts() ) :
- ?>
- <h3 id="related">Videos in series</h3>
- <ul class="posts posts-3 grid">
- <?php
- $i = 0;
- while ( $connected->have_posts() ) : $connected->the_post();
- $i++;
- ?>
- <li<?php if ($i == 3) {$i = 0; echo " class=\"last\"";} ?>>
- <?php unset($img); if ( current_theme_supports( 'post-thumbnails' ) && has_post_thumbnail() ) {
- $thumbURL = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), '' );
- $img = $thumbURL[0]; }
- else {
- unset($img);
- if ($wpzoom_cf_use == 'Yes') { $img = get_post_meta($post->ID, $wpzoom_cf_photo, true); }
- else {
- if (!$img) { $img = catch_that_image($post->ID); }
- } }
- if ($img){ $img = wpzoom_wpmu($img); ?>
- <div class="cover"><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"><img src="<?php bloginfo('template_directory'); ?>/scripts/timthumb.php?src=<?php echo $img ?>&h=155&w=210&zc=1" alt="<?php the_title(); ?>"/></a></div><?php } ?>
- <div class="postcontent">
- <h2><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><span class="speaker-name"><?php the_title(); ?></span></a></h2>
- <p class="postmetadata"><?php if ($wpzoom_homepost_date == 'Show') { ?><?php the_time("$dateformat"); ?><?php } ?><?php if ($wpzoom_homepost_date == 'Show' && $wpzoom_homepost_cat == 'Show') { ?> / <?php } ?><?php if ($wpzoom_homepost_cat == 'Show') { ?><?php the_category(', '); ?><?php } ?><br />
- <?php echo get_post_meta($post->ID, 'talk_location', true) ?></p>
- <?php the_excerpt(); ?>
- <?php if ($wpzoom_homepost_more == 'Show') { ?><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" class="readmore" rel="nofollow">read more</a><?php } ?> <?php edit_post_link( __('Edit this post', 'wpzoom'), ' | ', ''); ?>
- </div>
- </li>
- <?php endwhile; ?>
- </ul>
- <?php
- // Prevent weirdness
- wp_reset_postdata();
- endif;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement