<?php query_posts('category_name=array("upcoming-trips","closed")'); ?>
try this.
you haven’t read the codex.
Yes I had. Several times. And I experimented with it. This is why I hardly every post in the WP forums. Are you all so burnt out by the lame-o’s that you have to be pissy to everyone?
Display posts that have these categories, using category slug:
query_posts( 'category_name=staff,news' );
How is what I did different from the codex? I’m using category slugs separated by a comma.
Chinmoy29 I tried that and it didn’t worked. Tanked the whole query again.
Here is the whole section if it helps:
`<p><select name=”trip” multiple size=”6″>
<?php query_posts(‘category_name=upcoming-trips’); ?>
<? while (have_posts()) : the_post(); ?>
<option value=”<?php the_title(); ?>”><?php the_title(); ?></option>
<?php endwhile; ?>
<option value=”No Specific Trip”>No Specific Trip</option>
</select></p>`
Hi, in the codex it has that example:
query_posts( 'category_name=staff,news' );
It says the category slug, are “upcoming-trips,closed” the category slugs? If not i’ll try something.
Dan
Oh, hang on…
<? while (have_posts()) : the_post(); ?>
Should be;
<?php while (have_posts()) : the_post(); ?>
Hey I used the category numbers method and it works. I don’t see why the slugs wouldn’t work, but it is what it is. Thanks for your input folks.
BTW g3legacy, for non-outputting php5 its okay to have <? only, but it was an accident in this case.
Yes I had. Several times. And I experimented with it.
my apology – you are right.
up to recently it was known fact that you cannot use more than one category slug with ‘category_name’.
the codex must have been edited recently, and this wrong information must have been added (i can only guess that being able to use more than one category slug might be planned for wp3.1 (?))
you probably have to switch to category ids to show posts of more than one category;
to make this more automated, get the category id from the category slug:
<?php $cat_slug = 'closed';
$caty = get_term_by('slug', $cat_slug, 'category' );
$cat_id = $caty->term_id; ?>
http://codex.wordpress.org/Function_Reference/get_term_by