Custom Post Type Siblings
-
I am using a hierarchical custom post type for a magazine on my website. The idea is that each article of an issue will be published as a child post of the parent issue post. For example issue number 1 would be ‘issue 1’ and article number 1 of that issue would be ‘issue 1 -> article 1’. Article two would be ‘issue -> article 2’ and so on.
My problem is with the table of contents. I want to list all posts of an issue with the issue post itself and with all of the single article posts. In that list I want to be able to use the post images (featured image) and check if a custom field exist in each post (that tells me if the post is open to everyone or just subscribers).
Now I am using this code that lists the sibling post names and links:
<?php if($post->post_parent) $children = wp_list_pages("post_type=tolublad&title_li=&child_of=".$post->post_parent."&echo=0"); else $children = wp_list_pages("post_type=tolublad&title_li=&child_of=".$post->ID."&echo=0"); if ($children) { ?> <ul> <h4>í tessu t?lublaei:</h4> <?php echo $children; ?> </ul> <?php } ?>
Is there a way for me to set up a custom query that calls siblings of the current post? Or can I call the featured image and check a custom field with wp_list_pages function?
You can see my site in action at skastrik.is but be aware that the site is in icelandic. You can see the sibling list if you click “Efnisyfirlit” in the top left corner.
- The topic ‘Custom Post Type Siblings’ is closed to new replies.