Forums

Show more than one post from specific ID (3 posts)

  1. lucamisk
    Member
    Posted 1 year ago #

    Hi to everyone,
    I'm Luca from Italy.
    I just want to show 3 post in a category-page starting from their ID using query_posts() (or something similar...).

    I have a look in codex section and see that I can show posts in more than one category using this code.
    query_posts('cat=2,6,17,38');

    so I try to use the same code for searching some ID like
    query_posts('p=2234,2245,3455,2356');
    but it doesn't work, it show me just the first one!
    I also try with array but without success...

    Is there anyone that can help me? I really need this because I want to compare different posts (3) starting from their ID (choosing by users).

    Thanks in advance
    Luca

  2. alchymyth
    The Sweeper
    Posted 1 year ago #

    'post__in' => array(5,12,2,14,7) - inclusion, lets you specify the post IDs to retrieve (you cannot combine post__in and post__not_in in the same query)

    http://codex.wordpress.org/Function_Reference/query_posts#Post_.26_Page_Parameters

  3. lucamisk
    Member
    Posted 1 year ago #

    ohhhh...i have read that page for hour...it was so close and easy.. :-|||
    Thanks alchymyth!

Topic Closed

This topic has been closed to new replies.

About this Topic