WordPress.org

Ready to get started?Download WordPress

Forums

Simple Fields
Display randomly (2 posts)

  1. Vayu Robins
    Member
    Posted 3 years ago #

    Hi.

    Lets say I have 5 images on a page loaded with Simple fields plugin. How can I display 2 at time randomly?

    Thanks
    Vayu

    http://wordpress.org/extend/plugins/simple-fields/

  2. Vayu Robins
    Member
    Posted 3 years ago #

    I actually found the solution to my own question. Here it is for everyone else.

    $features = simple_fields_get_post_group_values(get_the_ID(), 3, true, 2);
    shuffle($features);
    
    for($i = 0; $i < count($features); $i++) {
    
    	if($i < 2) {
    
    		echo wp_get_attachment_image($features[$i]['Billede'];
    
    	}
    
    }

    Cheers
    Vayu

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic