This is a bit over my head….$display_categories = array
-
I think this has something to do with me trying to mix strings and arrays….Help please to combine the $option into the array….
<?php $categories = get_categories('child_of=20'); foreach ($categories as $cat) { $option = ''; $option .= ''.$cat->cat_ID.', '; echo $option; // This currently outputs: 21, 22, I need to insert this for the array below like this: $display_categories = array(21, 22,); } // enter the IDs of the categories to display $display_categories = array(21, 22,); // I tried entering array($option); here and only get the last category foreach ($display_categories as $category) { ?> <?php query_posts("showposts=1&orderby=rand&cat=$category"); ?> <?php while (have_posts()) : the_post(); ?> <div class="cat-3content"> <div align="center"><a href="<?php echo get_category_link($category);?>"><?php echo the_excerpt(); ?></a> </div> <h6><a href="<?php echo get_category_link($category);?>"><?php single_cat_title(); ?></a></h6> </div> <?php endwhile; ?> <?php } ?>
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘This is a bit over my head….$display_categories = array’ is closed to new replies.