<?php //Gets category info global $wp_query; $cats = get_the_category(); $tempQuery = $wp_query; $currentId = $post->ID; //related category posts $catlist = ""; forEach( $cats as $c ) { if( $catlist != "" ) { $catlist .= ","; } $catlist .= $c->cat_ID; } $newQuery = "posts_per_page=6&orderby=rand&cat=" . $catlist; query_posts( $newQuery ); $categoryPosts = ""; $count =… Continue reading Related posts
Tag: lists
Random Post list
<ul> <?php $args = array( ‘numberposts’ => 5, ‘orderby’ => ‘rand’ ); $rand_posts = get_posts( $args ); foreach( $rand_posts as $post ) : ?> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> <?php endforeach; ?> </ul>