Created
August 10, 2012 04:06
-
-
Save furahaclothing/3310979 to your computer and use it in GitHub Desktop.
single.phpに同じカテゴリー内の別の記事をランダム表示
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php $cat = get_the_category(); $cat = $cat[0]; ?> | |
<?php $bk_wp_query = clone $wp_query; ?> | |
<?php queryposts( array('cat' => $cat->cat_ID, 'showposts' => 5, | |
'orderby' => 'rand', 'post_not_in' => array($post->ID)) ); ?> | |
<?php while (have_posts()) : the_post(); ?> | |
"><?php the_title(); ?> | |
<?php endwhile; ?> | |
<?php $wp_query = clone $bk_wp_query; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment