Title: Random image php question?
Last modified: August 18, 2016

---

# Random image php question?

 *  [davey579](https://wordpress.org/support/users/davey579/)
 * (@davey579)
 * [18 years, 7 months ago](https://wordpress.org/support/topic/random-image-php-question/)
 * I’m using the [random image plugin](http://justinsomnia.org/2005/09/random-image-plugin-for-wordpress/).
   But now I want to show random images from the category where one entry is in (
   I’m using this in single.php).
 *     ```
       <?php randomimage(show_post_title,
                         number_of_images,
                         image_attributes,
                         show_alt_caption,
                         image_src_regex,
                         post_type,
                         inter_post_html,
                         category_filter,
                         sort_images_randomly,
                         image_class_match,
                         image_template_html); ?>
       ```
   
 * Now I’m using this:
 *     ```
       <?php randomimage(true, 4, "width='88'", false, "(.gif)", posts, "", "<?php the_category_ID(); ?>", true, "", ""); ?>
       ```
   
 * But that won’t do the trick. So, how can I do this?

Viewing 1 replies (of 1 total)

 *  Thread Starter [davey579](https://wordpress.org/support/users/davey579/)
 * (@davey579)
 * [18 years, 7 months ago](https://wordpress.org/support/topic/random-image-php-question/#post-607669)
 * I played around with the php code and it works now:
 *     ```
       <?php $catid = the_category_ID(); randomimage(true, 4, "width='88'", false, "(.gif)", posts, "", "$catid", true, "", ""); ?>
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘Random image php question?’ is closed to new replies.

 * 1 reply
 * 1 participant
 * Last reply from: [davey579](https://wordpress.org/support/users/davey579/)
 * Last activity: [18 years, 7 months ago](https://wordpress.org/support/topic/random-image-php-question/#post-607669)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
