jeudi 25 mai 2017

Random Loop Filter

Hi guys wondering if anyone can help. I have this code that lists all sub pages, their featured image and title/link. What I'd like to be able to do is randomize the the size of the featured image between what Wordpress offers... small/medium/large?

Any ideas?

<?php 
$args = array(
    'parent' => 2,
    'post_type' => 'page',
    'post_status' => 'publish'
); 
$pages = get_pages($args);  ?>
<ul> 
<?php
foreach( $pages as $page ) {
?>

 <li>
    <a href="<?php echo  get_permalink($page->ID); ?>" rel="bookmark" title="<?php echo $page->post_title; ?>">
    <div><span class="thumbnail"><?php echo get_the_post_thumbnail($page->ID, 'thumbnail'); ?></span>
    <span class="title"><?php echo $page->post_title; ?></span></div>
    </a>
</li>
<?php
 }  
?>
</ul>




Aucun commentaire:

Enregistrer un commentaire