WordPress.org

Forums

Custom Loop: wanna print all posts giving a limit to a specific category (1 post)

  1. nemseck
    Member
    Posted 2 years ago #

    Ciao a tutti è il mio primo post su questo forum, anche se seguo l'attività da tempo.
    Mi presento a tutti con un problema che ho riscontrato su un progetto che sto sviluppando.

    Hi guys, it's my first post right here since I've been following all discussions for a long time.
    I got an issue I can't manage with other user replies, so here is it:

    I'm developing a website in which I use a single custom loop for "posts" and custom type "projects" and "publications".

    Under "posts" (that are regular WP posts) I got some categories and I have the need to restrict the number of items displayed by one of them.

    here's my starting loop code

    <?php
    $wp_query = new WP_Query(array( 'post_type' => array('project', 'post', 'publication'), 'showposts' =>-1));
    if (have_posts()): while ( $wp_query->have_posts() ) : $wp_query->the_post();
    ?>

    actually I've setted "showposts" to "-1" to display all posts of all types/categories.

    what I need is to keep this single loop up and limiting the category ID "10" of post-type "posts" to "showposts =>5".

    Is that possible? Thank you so much for any kind of suggestion!

Topic Closed

This topic has been closed to new replies.

About this Topic