Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

fromstephen on "get_terms orderby random not working"

$
0
0

Hi

Im trying to get list a custom taxonomy category list with a random order. So that every time you refresh the page, a new order appears.

So far i can list the custom taxonomy but I can't get the random orderly to work.

Any help would be appreciated.


<?php

foreach (get_terms('your_taxonomy' ,
array(
"orderby" => "rand",
"number" => 5,
'hide_empty' => 1,
'exclude' => array($cat->term_id),

)) as $cat) :

?>

<li class='post'>
slug, 'your_taxonomy'); ?>"><div class='thumb-post'>

<img src="<?php echo z_taxonomy_image_url($cat->term_id, 'poster'); ?>" />

</div>
<h2> <?php echo $cat->name; ?></h2>
<p class='meta'>
Directed By <?php echo single_cat_title('' , false); ?>
</p>

<?php endforeach; ?>


Viewing all articles
Browse latest Browse all 8245

Trending Articles