Support

Account

Home Forums General Issues Field to display Posts and filter then by the value of a Field?

Helping

Field to display Posts and filter then by the value of a Field?

  • I’m attempting to develop a full blown Project Management utility using the Advanced Custom Fields Plugin.

    I’ve used the CPT UI Plugin to create a CPT called “Projects” and another called “Tasks”. Then I used ACF to create Custom Fields for them.

    One of the fields on Tasks is called “Project” and it’s a Post Object field type. It allows the user to select from a list Projects in the “Projects” CPT I created.

    Now what I’m trying to achieve is to display a list of Tasks that correspond with the currently viewed Project – as any normal project manager does. I suppose this requires a custom ACF Field to be created, but I thought I would ask here first in case someone has a solution.

    Ex.
    All Projects List
    My Project #1
    My Project #2

    All Tasks List
    My Task #1 whose Project is My Project #1
    My Task #2 whose Project is My Project #1
    My Task #3 whose Project is My Project #2

    Single Project View for Project #1
    – Tasks
    – – My Task #1
    – – My Task #2

  • Elliot has created a tutorial about querying relationship field here: http://www.advancedcustomfields.com/resources/querying-relationship-fields/

    This would be a bit different. A Post Object field holds a single value rather than an array, so this makes it easier. Basically you just need to query the tasks post type with a meta_query to look for the ID of the project.

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Field to display Posts and filter then by the value of a Field?’ is closed to new replies.