WordPress.org

Ready to get started?Download WordPress

Forums

Exclude a certain category and it's children (4 posts)

  1. Sigidi
    Member
    Posted 3 years ago #

    I am trying to exclude category 250 and it's child. Can someone help. This is how my code looks like

    <?php
     $postslist = get_posts('numberposts=6&order=DESC');
     foreach ($postslist as $post) :
        setup_postdata($post);
     ?>
        <div id="time">
          <?php the_date(); ?>
        </div>
        <dt><a href="<?php echo get_permalink() ?>" rel="bookmark" title="<?php _e('Read more about:','myTheme')?> <?php the_title(); ?>">
          <?php the_title(); ?>
          </a> </dt>
        <?php endforeach; ?>
      </div>

    How can i do this on this line?

    $postslist = get_posts('numberposts=6&order=DESC');

    Please help

  2. Sigidi
    Member
    Posted 3 years ago #

    Can anyone help Please

  3. keesiemeijer
    moderator
    Posted 3 years ago #

    try this:
    $postslist = get_posts('numberposts=6&order=DESC&category=-250');

  4. Sigidi
    Member
    Posted 3 years ago #

    Just tried it, no luck. I'm stuck

Topic Closed

This topic has been closed to new replies.

About this Topic