posts to pull from subcategory
-
I have been working with a programmer on a custom theme. It is almost right but i want the home page to pull from posts within a subcategory of a category. here is the code in the functions.php
<?php $prim_post_id = get_option('home_prime_slider'); ?> <th scope="row"><label for="pri_slider">Select The Category For Slider</label></th> <td> <select name="slider_cat" id="slider_cat"> <option>SELECT</option> <?php // Get all categories $slider_cat_id = get_option('slider_category'); $args = array( 'type' => 'post', 'taxonomy'=> 'category' ); $categories = get_categories( $args ); foreach ( $categories as $cat ): if( $cat->term_id == $slider_cat_id ): echo '<option value="'.$cat->term_id.'" selected="selected">'.$cat->name.'</option>'; else: echo '<option value="'.$cat->term_id.'">'.$cat->name.'</option>'; endif; endforeach; ?>
can anyone guide me as to how to adapt this to include subcategories of the main category?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘posts to pull from subcategory’ is closed to new replies.