I am working on a WordPress theme,I managed to create post relationships using Types plugin I created a tutorials CPT as parent and chapters CPT as child
I managed to display the child posts of the parent using
$child_posts = types_child_posts("chapters");
But now I am struggled at displaying the children list on the child pages, I mean when I am on a single chapter I need to display a list of the other chapters within the same parent
I managed to get the parent post id using Types API
$parent_id = wpcf_pr_post_get_belongs(get_the_ID(), 'tutorials');
But I can't find a way to use the id in the chapter pages to get an array of other chapters in this tutorial
What I Have Tried
- using
WP_Query();
- using
$child_posts =get_posts($childargs);
- using
get_posts();
but all of the didn't do it unfortunately
Any help will be appreciated.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire