Yeah, I figured that WP wouldn't parse that the way I thought but it's mainly for a plugin that I've wrote. I was trying to figure out how WP accepted multiple values to one key in query string style functions. Then I realized I was thinking about it too hard and that WP itself probably just explodes the string at the commas after parsing the query using parse_str(); and that I could probably do exactly the same.
I do it all the time, as my IT teacher once said I always try to avert occam's razor when I shouldn't. Thanks for explaining that DD32 that should help a lot with my plugin. :) Paul. 2008/12/27 DD32 <[email protected]> > cat=1,2,3,4,5 style arguements are WP exploding the value by commas as you > thought > > There are 2 ways to call arguements in WP, Via a string, as you are doing, > or via an array: > > query_posts('showposts=2'); > is identical to: > query_posts( array( 'showposts' => 2 ) ); > > However, I do not think that query of yours above about showposts[post1] > and > showposts[post2] would work as you expect it to.. Yes, It'll convert it to > an array, however, WordPress converts it back to a int, as that param is > only designed to limit the number of results retuened. > > Taken directly from wp-includes/query.php (line ~1200) is this: > $array_keys = array('category__in', 'category__not_in', > 'category__and', 'post__in', 'post__not_in', 'tag__in', 'tag__not_in', > 'tag__and', 'tag_slug__in', 'tag_slug__and'); > > Those are the only keys which WP expects an array for, others which deal > with Categories and Tags need to be passed as a string, ie: array('cat' => > '1, 2, 3), If you were trying to only show 2 known posts, then you'd be > after array('post__in' => array(1, 2)); > > > 2008/12/28 Paul Robinson <[email protected]> > > > Lol, sorry. I found out that if you are developing a plugin & you are > using > > a system that allows the definition of arguments like showposts=4&cat=1 > etc > > you can define arrayed values in the query string using square brackets > > like > > this showposts[post]=1&showposts[post2]=2&cat=1. According to the same > site > > I found that from though it is impossible to provide multiple values to > one > > parameter... I wish there was a way though because that way I found still > > doesn't work for what I want to do... > > > > Anyone else got any ideas. I know you can get multiple categories in > > wordpress like this cat=1,2,3,4 but I've never figured out how WP does > > that... I'm assuming it uses parse_str() to parse the query string to > > variables & then explodes cat like explode(',', $cat); type of thing. Is > > that right? > > > > Paul. > > > > 2008/12/27 Stephen Rider <[email protected]> > > > > > To help other readers on the list, you should generally specify *what* > > you > > > figured out when you post something like this. Share the info! :) > > > > > > On Dec 27, 2008, at 10:37 AM, Paul Robinson wrote: > > > > > > Scrap that question I've just this minute figured it out. > > >> > > >> 2008/12/27 Paul Robinson <[email protected]> > > >> > > >> 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'); ?> > > >>> > > >> _______________________________________________ > > > 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
