Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- global $post;
- $categories = get_the_category($post->ID);
- if($categories) {
- foreach( $categories as $individual_category ) {
- $category_ids[] = $individual_category->term_id;
- }
- $args = array(
- 'category__in' => array($category_ids),
- 'numberposts' => 3, /* You can change this to show more */
- 'post__not_in' => array($post->ID),
- 'post_type' => 'mirage-parties'
- );
- $related_posts = get_posts( $args );
- if($related_posts) {
- echo '<section class="row row--flex row--fullwidth"><div class="small-12 medium-9 medium-centered"><h2>Related Posts</h2></div>';
- foreach ( $related_posts as $post ) : setup_postdata( $post ); ?>
- <figure id="post-<?php the_ID(); ?>" <?php post_class('casestudyfigure'); ?>>
- <!-- post thumbnail -->
- <?php if ( has_post_thumbnail()) : // Check if thumbnail exists ?>
- <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
- <?php the_post_thumbnail('large-size'); // Declare pixel size you need inside the array ?>
- </a>
- <?php endif; ?>
- <!-- /post thumbnail -->
- <figcaption class="casestudyfigure__caption">
- <h3><?php the_title(); ?></h3>
- <p><?php miragewp_excerpt('miragewp_index'); ?></p>
- </figcaption>
- </figure>
- <!-- /article -->
- <?php endforeach; }
- }
- wp_reset_postdata();
- echo '</section>';
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement