Question

here is what i definded so war in functions.php

function create_post_type(){
    register_post_type('my_persons', 
        array('labels' => 
            array(
                'name' => __('Persons'),
                'singular_name' => __('Person')
            ),
            'public' => true,
            'menu_position' => 5,
            'rewrite' => array('slug' => 'persons'),
             'supports' => array('title', 'editor','thumbnail')
        )
    );
    register_post_type('my_shoes', 
        array('labels' => 
            array(
                'name' => __('Shoes'),
                'singular_name' => __('Shoe')
            ),
            'public' => true,
            'menu_position' => 6,
            'rewrite' => array('slug' => 'shoes'),
             'supports' => array('title', 'editor')
        )
    );
    }
add_action('init', 'create_post_type');

What I'm trying to do is, when adding a new Person, I want to see a list of (already added) Shoes and select (via checkbox) which shoes he owns.

I already installed the "Advanced Custom Fields" Plugin. I know it is possible to define a CheckBox List of Shoes in there and use it as fields for Persons. But I want this field to be dynamically filled, when adding new "Shoes" custom posts.

It's hard to explain, but I guess you get the point. I am using Wordpress 3.7.1 by the way and I am completely new to this.

Any help is appreciated ;-)

Was it helpful?

Solution

See the Documentation here :

you will need to use a filter my_acf_load_field( $field ) , then query for your custom post type shoes : for example

 query_posts(array( 
        'post_type' => 'shoes',
        'showposts' => 10 
    ) );  

And then populate the array of fields like the code examples in documentation.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top