WordPress.org

Forums

Toolset Types
[Plugin: Types - Custom Fields and Custom Post Types Management] Listing Related Custom Post TYpes (8 posts)

  1. bluebird2
    Member
    Posted 4 years ago #

    I am using this plugin to create a Project Management website.

    In the website every project has a set of "tasks" which are created as a new custom post type. In the admin I can add new tasks to any project. My problem is how I can show a list of the tasks titles or titles+content on my project posts?

    Every project also has a client, which is another custom post type. I need to show every project's related client on the project post as well. How can I do that?

    http://wordpress.org/extend/plugins/types/

  2. Srdjan
    Member
    Posted 4 years ago #

    While in the loop, use:
    $children = types_child_posts('tasks');

    All Types fields related to 'tasks' are placed in 'fields' property of each returned results. Loop over returned results and render what you like.

    You can also specify second parameter:
    $children = types_child_posts('tasks', 'numberposts=5');
    Second parameter are query args WP can use when getting posts.

  3. bluebird2
    Member
    Posted 4 years ago #

    I used a PHP widget and placed this in the text area:
    <?php {$children=types_child_posts('task'); }?>
    But it did not work. Is there anything I miss here?

  4. bluebird2
    Member
    Posted 4 years ago #

    By the way how can I go back to the parent post from the child custom post type page? Is there any PHP code for that?

  5. Srdjan
    Member
    Posted 4 years ago #

    I think that code won't work from widget.
    Only from post loop.

    Don't understand question from last comment.
    Can you explain little more?

  6. bluebird2
    Member
    Posted 4 years ago #

    This is what I meant:
    From every project you have a list of tasks. Every item in the list is linked to a specific taks, that is a child post for that project.
    My question is how I can have a link back to the parent project on every task page.

  7. bluebird2
    Member
    Posted 4 years ago #

    Is there any shortcode for child posts or parent posts?

  8. Srdjan
    Member
    Posted 4 years ago #

    #1 No, there is not yet any call to get parent post. But actually you can use WP func for that, something like:
    get_permalink(get_post_meta($post_id, '_wpcf_belongs_project_id', true));
    Where $post_id is child post ID.

    #2 There are no shortcodes, only functions for that in Types. Views have shortcodes for that.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Toolset Types
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags