display custom meta field key/value pair in connected post query
-
Hi,
I am working completely inside the WP Admin and im trying to make the admin post edit screen display meta values for connected posts.
I have two CPTs Recipes and Ingredients. I have a p2p connection from->recipes to->ingredients many-to-many. Ingredients have a meta box with a normal custom field ‘cost’.
I want to list the meta value for cost on the recipe admin edit page in a meta box.
I want to do something similar to this example from the p2p wiki but get the meta value for the post id. (not p2p meta, the normal WP post meta)
<?php while( $connected->have_posts() ) : $connected->the_post(); echo '<li>'; the_title(); // Display count and type echo '<br>'; echo 'Count: ' . p2p_get_meta( get_post()->p2p_id, 'count', true ); echo '<br>'; echo 'Type: ' . p2p_get_meta( get_post()->p2p_id, 'type', true ); echo '</li>'; endwhile;
can someone point me in the right direction?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘display custom meta field key/value pair in connected post query’ is closed to new replies.