Thanks Otto, I'll check out how that handles it. Is it ok for me to call that function from within my plugin? I don't see why not, but I thought I'd ask.
Paul. 2008/12/27 Otto <[email protected]> > No, the wp_parse_args function handles it, so that individual > functions don't have to. It'll take an object or an array or a string > and handle it appropriately, returning the resulting parameters as a > named array. It'll also merge it with a set of default values. It's in > wp-includes/functions.php. > > > > > On Sat, Dec 27, 2008 at 5:14 PM, Paul Robinson <[email protected]> > wrote: > > So does WP have a check that differensiates between an array value & > query > > string value I dunno say something like this: > > > > if(is_array($arg)) > > extract($arg); > > else > > parse_str($arg); > > > > that way whether an array or a query string is passed it extracts the > > correct variables from the arguments provided? > > > > Paul. > > > > 2008/12/27 Otto <[email protected]> > > > >> There's several ways to do it, but my favorite is always the array > style. > >> > >> <?php > >> query_posts(array( > >> 'whatever' => 123, > >> 'somethingelse' => 'somevalue', > >> 'lotsofvalues' => array(1,2,3,4,5), > >> )); // close the query > >> ?> > >> > >> This makes it perfectly clear what is what, and multiple values are > >> specified by nested arrays. This style works almost everywhere. > >> > >> > >> -Otto > >> > >> > >> > >> On Sat, Dec 27, 2008 at 10:09 AM, Paul Robinson < > [email protected]> > >> wrote: > >> > This might be a little off topic, but you guys seem to know more about > >> the > >> > coding side of things than I could ever get out of the forum. > >> > > >> > Is there a way to provide more than one value to a parameter in an > >> arugment > >> > list. For example when you call query_posts(); can you do this: > >> > > >> > <?php query_posts('showposts=2,5'); ?> > >> > > >> > I know that wouldn't work but it's just an example. I'm building a > plugin > >> > and I need to allow more than one value to one key or parameter. > >> > > >> > Any ideas would be great, if not I'll just go on my neverending search > of > >> > google again. :P > >> > > >> > Again I'm really sorry about posting this here. Just you guys are soo > >> smart. > >> > :) > >> > > >> > Paul. > >> > _______________________________________________ > >> > wp-testers mailing list > >> > [email protected] > >> > http://lists.automattic.com/mailman/listinfo/wp-testers > >> > > >> _______________________________________________ > >> wp-testers mailing list > >> [email protected] > >> http://lists.automattic.com/mailman/listinfo/wp-testers > >> > > _______________________________________________ > > wp-testers mailing list > > [email protected] > > http://lists.automattic.com/mailman/listinfo/wp-testers > > > _______________________________________________ > wp-testers mailing list > [email protected] > http://lists.automattic.com/mailman/listinfo/wp-testers > _______________________________________________ wp-testers mailing list [email protected] http://lists.automattic.com/mailman/listinfo/wp-testers
