WordPress.org

Ready to get started?Download WordPress

Forums

get lates post but excluding others using categories (3 posts)

  1. lonchbox
    Member
    Posted 5 years ago #

    Hi,

    I´m trying to make in my home page a lates post space (not in the sidebar) and exclude some post using the categorie they have. I have been trying using wp_query and get_post but nothing works.

    This is one of the code I copy/paste to see if work

    <?php $recent = new WP_Query("showposts=1&exclude=142,143,144,157"); while($recent->have_posts()) : $recent->the_post();?>

    How can I do it ? Help!
    Thanx.

  2. stvwlf
    Member
    Posted 5 years ago #

    <?php wp_query('showposts=1&cat=-142,-143,-144,-157');
    while (have_posts()) : the_post();
       the_content();
    endwhile;
  3. lonchbox
    Member
    Posted 5 years ago #

    Thanx :D ! stvwlf ...

Topic Closed

This topic has been closed to new replies.

About this Topic