mostly single updates
This commit is contained in:
59
single.php
59
single.php
@@ -69,13 +69,67 @@
|
||||
<hr class="content-wrap content-end">
|
||||
</div>
|
||||
|
||||
<!-- Related articles -->
|
||||
<?php
|
||||
$orig_post = $post;
|
||||
global $post;
|
||||
$categories = get_the_category($post->ID);
|
||||
|
||||
if ($categories) {
|
||||
$category_ids = array();
|
||||
|
||||
foreach($categories as $individual_category) $category_ids[] = $individual_category->term_id;
|
||||
$args=array(
|
||||
'category__in' => $category_ids,
|
||||
'post__not_in' => array($post->ID),
|
||||
'posts_per_page'=> 3, // Number of related posts that will be shown.
|
||||
'caller_get_posts'=>1
|
||||
);
|
||||
|
||||
$my_query = new wp_query( $args );
|
||||
console_debug($my_query);
|
||||
if( $my_query->have_posts() ) {
|
||||
?>
|
||||
<div id="related_posts"><h3><?php _e('More posts:', 'dis2019');?></h3><ul>
|
||||
<?php
|
||||
while( $my_query->have_posts() ) {
|
||||
$my_query->the_post();
|
||||
?>
|
||||
|
||||
<li>
|
||||
<div class="relatedthumb">
|
||||
<a href="<? the_permalink();?>" rel="bookmark" title="<?php the_title(); ?>">
|
||||
<?php the_post_thumbnail('home-square-thumbnail'); ?>
|
||||
</a>
|
||||
</div>
|
||||
<div class="relatedcontent">
|
||||
<h3>
|
||||
<a href="<? the_permalink();?>" rel="bookmark" title="<?php the_title(); ?>">
|
||||
<?php the_title(); ?>
|
||||
</a>
|
||||
</h3>
|
||||
</div>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
echo '</ul></div>';
|
||||
}
|
||||
};
|
||||
$post = $orig_post;
|
||||
wp_reset_query(); ?>
|
||||
|
||||
<?php _e('Back to home:', 'dis2019');?>
|
||||
<hr class="related-wrap single-end">
|
||||
|
||||
</article>
|
||||
<!-- /article -->
|
||||
|
||||
|
||||
|
||||
<?php endwhile;?>
|
||||
|
||||
|
||||
|
||||
<?php else: ?>
|
||||
|
||||
<!-- article -->
|
||||
@@ -88,10 +142,13 @@
|
||||
|
||||
<?php endif;?>
|
||||
|
||||
|
||||
|
||||
|
||||
</section>
|
||||
<!-- /section -->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<?php get_footer();?>
|
||||
Reference in New Issue
Block a user