ポスト関連記事 出力コード
<?php related_posts(); ?>
css
/*-----------------------------------------------------YARPPプラグイン用-----------------------------------------------------*/
.related-post{
height:100%;
}
.related-post{
width:100%;
overflow:hidden;
margin-top:5px;
}
.related-entry {
vertical-align: top;
float: left;
width:123px;
font-size: 13px;
min-height: 210px;
margin-bottom:0px;
padding: 0px 10px 0px 10px;
display: block;
}
.related-entry img{
padding: 4px;
border: #ccc 1px solid;
width: 123px;
height: 123px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 5px;
margin-left: 0px;
}
#post-syokai2{
border-left: 10px solid #999;
padding: 1px 9px;
margin: 5px 0 16px 0;
font-size: 16px;
margin-left: 5px;
}
.kannrenn h3{
background-color: #c1c1ff;
font-size: 14px;
color: #494a41;
margin: 35px 0 10px 0;
padding: 5px 0px 5px 20px;
}
.kannrenn ul{
list-style-type: none;
}
.kannrenn ul li{
float: left;
width: 100px;
line-height: 21px;
margin: 0 13px 0 0;
}
yarpp-template-d1.php
<?php if(have_posts()):?>
<div style="padding-top:0px;"></div>
<h2 id="post-syokai2">関連記事はこちら</h2>
<div class="related-post">
<?php while(have_posts()) : the_post(); ?>
<?php if(has_post_thumbnail()):?>
<h3><div class="related-entry"><a href="<?php the_permalink() ?>"rel="bookmark"title="<?php the_title_attribute(); ?>"><?php $title= get_the_title(); the_post_thumbnail("thumbnail",array( 'alt' =>$title)); ?><?php the_title(); ?></a></div>
<?php else: ?>
<div class="related-entry"><a href="<?php the_permalink() ?>"rel="bookmark"title="<?php the_title_attribute(); ?>">
<img src="<?php echo home_url(); ?>/wp-content/plugins/wordpress-popular-posts/no_thumb.jpg" alt="<?php $title= get_the_title(); echo $title ?>" />
<?php the_title(); ?></a></div></h3>
<?php endif; ?>
<?php endwhile; ?>
</div>
<?php else: ?>
<?php endif; ?>