• Hi scribu,

    First of all; a BIG thank you for this brilliant plugin! This saved me so much work. As a matter of fact I think this should be a standard function in WordPress 4 or whatever ??

    I was wundering how I can access the values in a connection field from a connection type? For example, I have the following connection type with the connection field called childtype:

    $participant_connection = p2p_register_connection_type( array(
            'from' => 'post-type-parent',
    		'to' => 'post-type-child',
    		'fields' => array(
    			'childtype' => array(
    				'title' => 'Type',
    				'values' => array('value1', 'value2', 'value3', 'value4','value5')
    			)
    		)
        ) );

    Which works great by the way, I get the childtype within the loop like this:
    p2p_get_meta($post->p2p_id, 'childtype', true);

    But I want to get all the values from the childtype->values array outside the loop and use them in a foreach loop. Something like this:

    $terms = p2p_get_meta($connected->childtype->values);
    foreach($terms as $type):
      echo $type->value;
    endforeach;

    Obviously $terms = p2p_get_meta(childtype->values); isn’t working yet, but that’s the idea. How should I access these values?
    Thanks for your time so far!

    Cheers, Toine

Viewing 16 replies (of 16 total)
  • Thread Starter Twansparant

    (@twansparant)

    You are right again! ??
    Somehow the ‘suppress_filters’ line was messing up my queries.
    Thanks a lot!

Viewing 16 replies (of 16 total)
  • The topic ‘[Plugin: Posts 2 Posts] Access values in connection field array?’ is closed to new replies.