Show parents and child
-
I have a parent local-festival with child “coordenada-festival”
But when i use
$child_posts = types_child_posts("local-festival"); foreach ($child_posts as $child_post) { echo $child_post->post_title; echo $child_post->fields['description']; }
or
$childargs = array( 'post_type' => 'local-festival', 'numberposts' => -1, 'meta_key' => 'wpcf-description', 'orderby' => 'meta_value', 'order' => 'ASC', 'meta_query' => array(array('key' => '_wpcf_belongs_coordenada-festival_id', 'value' => get_the_ID())) ); $child_posts = get_posts($childargs);
Always return
array (size=0) empty
Whats happened?
I have that posts:
(PARENT)POST TYPE: local-festival
–>Post1: Local1
–>Title: Coordenada1
–>Text: Coordenada1
–>Title: CoordenadaXPTO
–>Text: CoordenadaXPTO
–>Post2_ Local2
–>Title: Coordenada2
–>Text: Coordenada2
–>Post3: Local3
–>Title: Coordenada3
–>Text: Coordenada3
______________________________________
(CHILD) POST TYPE: coordenada-festival
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Show parents and child’ is closed to new replies.