I’m using the “PHP Code for Posts and Pages” plugin at
www.AvengersCollectibles.com/wp to echo a shortcode (Amazon list from “Azon Pro Shopping List” in this case) if the in_category(Captain America) criteria is met and found 25 good product categories to offer.
Unfortunately, Amazon limits API calls to something like 2000/hr.
With that said, I’m trying to have the script randomly select one of 5 shortcodes (5 lists with 5 product categories each). I think I’m on the right track but can not seem to get the code correct:
Currently works:
<?php if (in_category('Captain America')) echo do_shortcode('[asle id=11]'); ?>Example of random selection:
<?php $input = array("Neo", "Morpheus", "Trinity", "Cypher", "Tank"); $rand_keys = array_rand($input, 2); echo $input[$rand_keys[0]] . "\n"; echo $input[$rand_keys[1]] . "\n"; ?>but not quite sure how to combine the two. Any ideas?
Cory Buford
Virtual Realty Consultant