• Hi,
    I did some searches but haven’t found any code for this.
    I would like to display latest posts from subcategories from this main category. Here is the structure.

    – Video main category
    — cars sub category
    — post 1
    — post 2

    I want to able to display the latest posts “post 1 and post 2” under “video” without showing sub-category “cars”.

    thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter radiofranky

    (@radiofranky)

    I want to get only the latest posts from “video” main category which has multiple sub categories.

    only 4 latest posts among all the sub directories.
    I’ve seen a lot of code that get post from each of the sub-categories.

    thanks

    Thread Starter radiofranky

    (@radiofranky)

    got it working.

    here is the code in case someone needs it. Cheers

    <?php
    if {$first_cat_parent) {
    $parent_posts = get_posts('numberposts=5&category='.$first_cat_parent);
    foreach($parent_posts as $post) : ?>
        <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li><br />
    <?php endforeach;
    }  // if $first_cat_parent
    ?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘how to get posts from sub categories without showing subcategories?’ is closed to new replies.