- <?php get_header(); ?>
- <?php
- $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),
- 'showposts'=>5, // Number of related posts that will be shown.
- 'caller_get_posts'=>1
- );
- $rp_query = new wp_query($args);
- }
- ?>
- <div id="content">
- <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
- <?php the_title('<h4>', '</h4>'); ?>
- <div class="postmeta">Publicado por
- <?php the_author_posts_link(); ?>
- el <?php the_time('d M, Y') ?>
- <div class="addthis_toolbox addthis_default_style" style="margin-top:8px;">
- <a class="addthis_button_facebook_like" fb:like:width="100" fb:like:layout="button_count"></a>
- <a class="addthis_button_tweet"></a>
- <a class="addthis_button_google_plusone" g:plusone:size="medium"></a>
-
- </div>
- <script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=xa-4e67489c228c415c"></script>
- </div>
- <div class="entry">
- <?php the_content(); ?>
- <div class="clear"></div>
- </div>
- <?php
- if( $rp_query->have_posts() ) {
- echo '<h3>Related Posts</h3><ul>';
- while ($rp_query->have_posts()) {
- $rp_query->the_post();
- ?>
- <li><?php the_post_thumbnail( thumbnail ); ?><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
- <?php
- }
- echo '</ul>';
- }
- ?>
- <?php comments_template(); ?>
- <?php endwhile; else: ?>
-
- <?php endif; ?>
- </div>
- <?php get_sidebar(); ?>
- <?php get_footer(); ?>