-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpage.php
28 lines (28 loc) · 1.15 KB
/
page.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php $tags = wp_get_post_tags($post->ID);
if ($tags) {
$first_tag = $tags[0]->term_id;
$args=array(
'tag__in' => array($first_tag),
'post__not_in' => array($post->ID),
'posts_per_page'=>4,
//'caller_get_posts'=>1,
'orderby'=>'rand'
);
$my_query = new wp_query( $args );
if( $my_query->have_posts() ) {
echo '<div id="related_posts" class="clear"><h3>Posts Relacionados</h3><ul class="related_posts_container">';
while( $my_query->have_posts() ) {
$my_query->the_post(); ?>
<li class="related_post">
<a class="related_post_img_container" href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>">
<?php the_post_thumbnail('medium', ['class' => 'related_post_img']); ?>
</a>
<div class="related_content">
<a href="<? the_permalink()?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a>
</div>
</li>
<? }
echo '</ul></div>';
} }
$post = $orig_post;
wp_reset_query(); ?>