WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Listing specific Custom Posts by ID (2 posts)

  1. ivyowl
    Member
    Posted 3 years ago #

    I want to show a list of posts from a Custom post type "Artists".

    I want to list them by their post ID.

    I want to show them on a at the end of the custom posts type "Events" posts.

    The list of post ID's will come from a custom Meta field in the "Events" post the key being $event_artists. (the field being a list of numbers separated by comma's.

    I can get it show posts from the blog so far no luck listing any "Artist" posts.

    I think a custom query would be best. But i just don't understand them that well.

    I've tried using get_posts with no luck as of yet.

    Any help would be much appreciated.

    Thanks in advance,

    Jonny

  2. ivyowl
    Member
    Posted 3 years ago #

    i've actually almost cracked it (i think!)

    This the code gives is close to what i want.

    the problems are.

    1. it only works if i use a specified post id, in this case 153.
    ($post->ID gives me nothing)

    2. although the echo $event_artists_list gives me: 167, 168 (which is the value of event_artists for post 153) it only lists 167 and not 168.

    appart from that it works perfectly.

    many thanks again.

    [Code moderated as per the Forum Rules. Please use the pastebin]

Topic Closed

This topic has been closed to new replies.

About this Topic