pass variable into ‘category_and’ array
-
This is my code:
<?php $id = get_category_by_slug('category-name'); ?> <?php query_posts(array('category__and'=>array($id,282))); ?> <?php while (have_posts()) : the_post(); ?> <h3><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3> <p><?php the_excerpt('Read more »'); ?></p> <?php endwhile; ?>
For some reason I can only get the query to work if I put to numeric values in they ‘category_and’=>array, but I need to pass a variable into it based on the current category (this code is in the category.php file).
Any help is hugely appreciated!
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘pass variable into ‘category_and’ array’ is closed to new replies.