Skip Navigation

[Resolved] Display list of posts from same connections (parrent post)

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 7 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 3 replies, has 2 voices.

Last updated by Shane 7 years, 9 months ago.

Assisted by: Shane.

Author
Posts
#481919

I am trying to: Display a list of posts from same parrent post.

I've read:
- https://toolset.com/documentation/customizing-sites-using-php/displaying-child-posts/
- https://toolset.com/documentation/customizing-sites-using-php/displaying-parent-posts/

Now, I'm looking for solution to show list of posts from same author on single book post (more book from same author of current post).

Thanks

#481982

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Synnove,

Thank you for contacting our support forum.

Actually you can do this with just using the function here https://codex.wordpress.org/Template_Tags/get_posts

You just need to specify the author you want the posts for and it will retrieve all the posts that belong to this author.

Thanks,
Shane

#481989

Thanks for reply!

The ''author'' I mean a post of a post type call ''Author'' and not WP post author.

Let me explain. I have a post type call "book" and post type call "author". Now the book post connect with post author. (One to many)

I want get and display a list of post on single book post from parrent post. In this case is "author".

Does it can be done with get_posts function?

#482063

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Synnove,

Thank you for the clarity in this case then the link here should be able to assist you.
https://toolset.com/documentation/customizing-sites-using-php/displaying-child-posts/

Specifically this code here.

$child_args = array(
'post_type' => 'room',
'numberposts' => -1,
'meta_key' => 'wpcf-genre',
'orderby' => 'meta_value',
'order' => 'ASC',
'meta_query' => array(array('key' => '_wpcf_belongs_writer_id', 'value' => get_the_ID()))
);
$child_posts = get_posts($child_args);

I would recommend getting our Views plugin as this can be achieved without doing any form of coding at all.

Thanks,
Shane

The forum ‘Types Community Support’ is closed to new topics and replies.