คำสั่ง random post จาก categories ของ post ปัจจุบัน

<?php /* assign the variable as current category */ ?>
<?php $categoryvariable $cat;?>

<?php /* concatenate the query */ ?>
<?php $args 'cat=' $categoryvariable '&rand&showposts=8'?>

<?php /* run the query */ ?>
<?php $posts query_posts($args); foreach($posts as $post) { ?>
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>
<?php ?>


credit: http://www.thaiseoboard.com/index.php?topic=259184.0

โพสต์ยอดนิยมจากบล็อกนี้

J2EE คืออะไร

วิธีแก้ : แก้ไขตารางแล้ว save ไม่ได้ ต้องสร้างใหม่ - Saving changes is not permitted in SQL Server Management Studio

การออกแบบ RESTful API - วิธีปฏิบัติที่ดี