[Plugin: Posts 2 Posts] Startswith in WP_Query
-
I successfully get the connected articles on a normal loop.
On some page, I have a an option to select the first letter to be able to drill down article via this alphabetical letter (A,B,C etc..)
so in my wp_query, i do
'query' => $wp_query) ;
or
'query' => $wp_query,'startswith'=>$theletter) ;
When using first query, I get all the connected.
If i start to drill down, ie Selecting A, then only the first record get the connection displayed.So if in first query i had 3 results with 3 connection each, in my second it will return the 3 results but only with the connections of the first one.
This is the code I use now to get connected
p2p_type( 'posts_to_destinations','posts_to_posts' )->each_connected( $wp_query, array(), 'articles' );
This is the previous code I used
remove_filter( 'posts_where', 'startswithaction' ); $the_query = null; $the_query = new WP_Query( array( 'suppress_filters' => false, 'post_type' => array( 'post', 'destination'), 'connected' => $post->ID ) );
- The topic ‘[Plugin: Posts 2 Posts] Startswith in WP_Query’ is closed to new replies.