Title: Multiple Random Pets
Last modified: August 21, 2016

---

# Multiple Random Pets

 *  [burnadette02](https://wordpress.org/support/users/burnadette02/)
 * (@burnadette02)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/multiple-random-pets/)
 * Hello,
 * I am trying to use either the shortcode option or the random pet widget to show
   random pets on my homepage. If I use the shortcode option the pets shown stay
   the same (the only thing I tried to change was pet.get to pet.getRandom in the
   php file). If I use the random pet widget I can’t figure out how to show more
   than 1 random pet (I’m not sure how to edit the php file to show another random
   pet, the best I could do was have it show the same one again). Any help?
 * [http://wordpress.org/plugins/petfinder-listings/](http://wordpress.org/plugins/petfinder-listings/)

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [rawrzors](https://wordpress.org/support/users/rawrzors/)
 * (@rawrzors)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/multiple-random-pets/#post-4278929)
 * Hi there! You were almost there with the getRandom, but the getRandom function
   returns a different XML structure than shelter.get.
 * In petfinder-listings.php:
 * 1. Change the API Call URL [http://api.petfinder.com/shelter.getPets?key=](http://api.petfinder.com/shelter.getPets?key=)
   
   to [http://api.petfinder.com/pet.getRandom?key=](http://api.petfinder.com/pet.getRandom?key=)
 * 2. Change if( count( $xml->pets->pet ) > 0 ){
    to if( count( $xml->pet ) > 0 ){
 * 3. Change foreach( $xml->pets->pet as $dog ){
    to foreach( $xml->pet as $dog ){
 * Let me know how it goes! Please note that this will cause site-wide changes.
 *  Thread Starter [burnadette02](https://wordpress.org/support/users/burnadette02/)
 * (@burnadette02)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/multiple-random-pets/#post-4278946)
 * Hello rawrzors,
 * Thanks for the reply. I tried that out and then it gave the output “No pets are
   listed for this shelter at this time. Please check back soon.”
 *  [rawrzors](https://wordpress.org/support/users/rawrzors/)
 * (@rawrzors)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/multiple-random-pets/#post-4278947)
 * Hi,
 * Please copy and paste your .php file into pastebin so I can take a look.
 *  Thread Starter [burnadette02](https://wordpress.org/support/users/burnadette02/)
 * (@burnadette02)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/multiple-random-pets/#post-4278961)
 * Hi,
 * [http://pastebin.com/egXGMcyB](http://pastebin.com/egXGMcyB)
 * I edited lines 348, 352, and 354
 *  [rawrzors](https://wordpress.org/support/users/rawrzors/)
 * (@rawrzors)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/multiple-random-pets/#post-4278962)
 * It shows that you changed lines 194, 199, and 201. I changed the same lines on
   mine.
 * Try using shortcode: [shelter_list]

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Multiple Random Pets’ is closed to new replies.

 * ![](https://ps.w.org/petfinder-listings/assets/icon.svg?rev=2204930)
 * [List Petfinder Pets](https://wordpress.org/plugins/petfinder-listings/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/petfinder-listings/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/petfinder-listings/)
 * [Active Topics](https://wordpress.org/support/plugin/petfinder-listings/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/petfinder-listings/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/petfinder-listings/reviews/)

## Tags

 * [multiple](https://wordpress.org/support/topic-tag/multiple/)

 * 5 replies
 * 2 participants
 * Last reply from: [rawrzors](https://wordpress.org/support/users/rawrzors/)
 * Last activity: [12 years, 7 months ago](https://wordpress.org/support/topic/multiple-random-pets/#post-4278962)
 * Status: not resolved