WordPress.org

Ready to get started?Download WordPress

Forums

the_category = custom post type (5 posts)

  1. donalyza
    Member
    Posted 4 years ago #

    Need help.

    For example, I have a category "personal". When you click on the link "Personal", it will list all the posts that's under "Personal Category".

    While in Custom Post Type, I created "movies". When I click on "Movies", I want to view all the custom post type that's under "movies".

    I'm looking for the equivalent usage of the_category(); and the_tag(); with custom post type. Is there such code for custom post type?

  2. David Gard
    Member
    Posted 4 years ago #

    Have a look at get_term(); and get_term_by();

    For a possible quicker answer - a 'please' or a 'thank you' wouln't go a miss in your post!

  3. donalyza
    Member
    Posted 4 years ago #

    I don't think that's the right code for the link for custom post type, I'm not sure but isn't it that works for taxonomy. Anyhow, I really appreciate your effort in answering my concern.

  4. chinmoy
    Member
    Posted 4 years ago #

  5. David Gard
    Member
    Posted 4 years ago #

    Ah, sorry, I misinturpreted your post. When you save a custom post type it is still stored within the 'wp_posts table', so should be able to use the standard queries. How about this...

    query_posts( array( 'post_type' => array('post', 'movies') ) );

    Taken from here - http://codex.wordpress.org/Function_Reference/query_posts

    This would show all Posts with a post type of either 'post' (which is what they are automatically given when you use the inbuilt 'Posts' menu) or 'movies'. If you only want 'movies' then get rid of 'post' and you should be golden.

Topic Closed

This topic has been closed to new replies.

About this Topic