Como inserir a função rand()
Boa tarde!
Gostaria de saber como exibir os artistas aleatoriamente no site http://seushow.com.br/bandas/
Atualmente, eles aparecem em ordem de cadastro.
Abaixo envio o código-fonte.
Obrigado
<?php
/*
* Template Name: Artists Listing
*/
?>
<?php get_header(); ?>
<main id="main">
<div class="container">
<?php if (ci_setting('artist_isotope') == 'enabled'): ?>
<div class="row">
<div class="col-xs-12">
<ul class="filters-nav group">
<li><a href="#filter" class="selected button" data-filter="*"><?php _e('Todos os artistas', 'ci_theme'); ?></a></li>
<?php
$args = array('hide_empty' => 1);
$skills = get_terms('artist-category', $args);
?>
<?php foreach ( $skills as $skill ): ?>
<li><a href="#filter" data-filter=".<?php echo $skill->slug; ?>" class="button"><?php echo $skill->name; ?></a></li>
<?php endforeach; ?>
</ul>
</div>
</div>
<?php endif; ?>
<div class="row">
<div class="col-xs-12">
<article <?php post_class('list'); ?>>
<div class="row filter-container">
<?php
global $paged, $wp_query;
$cols = ci_setting('artist_columns');
if(ci_setting('artist_isotope') != 'enabled') {
$args = array(
'post_type' => 'cpt_artist',
'posts_per_page' => ci_setting('artist_per_page'),
'paged' => $paged
);
}
else {
$args = array(
'post_type' => 'cpt_artist',
'posts_per_page' => -1
);
}
$artists = new WP_Query($args);
?>
<?php while ( $artists->have_posts() ) : $artists->the_post(); ?>
<?php $categories = wp_get_object_terms($post->ID, 'artist-category'); ?>
<div class="col-sm-6 <?php echo $cols; ?> <?php foreach ( $categories as $category ) : echo $category->slug.' '; endforeach; ?>">
<div class="item">
<figure class="item-thumb">
<a href="<?php the_permalink(); ?>">
<?php the_post_thumbnail('ci_thumb'); ?>
</a>
</figure>
<h4 class="item-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
</div>
</div>
<?php endwhile; ?>
</div>
<?php ci_pagination(array(), $artists); ?>
<?php wp_reset_postdata(); ?>
</article>
</div>
</div>
</div>
</main>
<?php get_footer(); ?>Discussão (0)
Carregando comentários...