[Plugin: Posts 2 Posts] How to query connected attachmets
-
Please, anyone can help me how to show attachments connected with post.
I know that there are specific query functions in WP to achieve similar goal but I want a curated list of related images.
I have already registered a connection type with
p2p_register_connection_type
hooked inwp_loaded
and created some connections between posts and some attachments.p2p_register_connection_type( array( 'name' => 'attachment_to_post', 'from' => 'attachment', 'to' => 'post', 'title' => 'Parceiros relacionados' ) );
Now how I query these connections in single post template?
I tried using the function
get_posts()
and also create a newWP_Query
object as shown in basic usage wiki https://github.com/scribu/wp-posts-to-posts/wiki/Basic-usage.I also tried using
get_connected()
but not returns connected attachments when Iprint_r()
query object.I’ve read the Wiki, tried to look at the code, I’ve tried so many things that it is difficult to list here.
Any help will be appreciated.
- The topic ‘[Plugin: Posts 2 Posts] How to query connected attachmets’ is closed to new replies.