scribu
Forum Replies Created
-
Forum: Plugins
In reply to: [Posts 2 Posts] Retaining connected post infoIs there a way to filter that output to only show the one location that was queried?
You need to store which location was queried, either by passing it as a URL parameter or saving it in a cookie.
Either way, you’ll need to write some custom PHP code.
Forum: Plugins
In reply to: [Posts 2 Posts] Retaining connected post infoThis sounds like a job for the
[p2p_connected]shortcode:Forum: Plugins
In reply to: [Posts 2 Posts] get all posts connected to a user?No, and that’s intentional. You can, however, specify multiple connection types:
$posts = get_posts( array( 'connection_type' => array( 'user_favorites', 'another_connection_type' ), 'connected_items' => $some_user_id_or_object, 'nopaging' => true, 'suppress_filters' => false ) );Forum: Plugins
In reply to: [Posts 2 Posts] Search in admin connection boxIn
admin/box.php, there’s a call to theget_connectable()method:https://github.com/scribu/wp-posts-to-posts/blob/master/admin/box.php#L181-188
Forum: Plugins
In reply to: [Posts 2 Posts] get_related only next and previous postTo be blunt, I currently have no interest in implementing this.
I already described the general idea in the previous post: http://ww.wp.xz.cn/support/topic/get_related-only-next-and-previous-post
Forum: Plugins
In reply to: [Posts 2 Posts] Ordering front end same as back endYou just need to use
WP_Query, instead ofp2p_get_connections().Forum: Plugins
In reply to: [XML Sitemap Generator for Google] Patch for wp-cli commandAnd here’s the command bundled as a separate plugin:
Forum: Plugins
In reply to: [Posts 2 Posts] get_related only next and previous postThe problem is that WP_Query doesn’t allow you to say “give me the post(s) that have post_date greater or smaller than this post here”.
You’d have to use the ‘posts_where’ filter to create a custom query var that does that.
It’s not rocket science, but it’s not trivial either.
Forum: Plugins
In reply to: [scbFramework] Shortcodes with html()I have no idea what you’re asking or why you would need what you’re asking.
Please post a more thorough explanation of the use case, and maybe some example code in a pastebin to go along with it.
Forum: Plugins
In reply to: [Posts 2 Posts] get_related only next and previous postNow I understand what you’re getting at. You can’t get adjacent items based on the post date, using the current API, but it would be a nice feature to have:
Forum: Plugins
In reply to: [Posts 2 Posts] get_related only next and previous postActually, get_adjacent_items() returns 3 post objects:
$items = p2p_type( 'posts_to_anime' )->get_adjacent_items( $episode_id ); echo get_permalink( $items['parent'] ); if ( $items['previous'] ) echo 'previous: ' . get_permalink( $items['previous'] ); if ( $items['next'] ) echo 'next: ' . get_permalink( $items['next'] );Also, are you sure your connection type has
'sortable' => true?Forum: Plugins
In reply to: [Posts 2 Posts] get_related only next and previous postTry using get_adjacent_items() then:
https://github.com/scribu/wp-posts-to-posts/blob/master/tests/test-core.php#L448-489
Forum: Plugins
In reply to: [Posts 2 Posts] get_related only next and previous postThe reason get_permalink() doesn’t work is because
get_previous()andget_next()don’t returnWP_Postobjects; they returnP2P_Item_Postobjects.This is fixed in the development version (1.5.2-alpha2).
Yes, when calling
p2p_register_connection_type(), you can pass either ‘to_query_vars’ or ‘from_query_vars’ to filter the candidates.Or, you can use the ‘p2p_connectable_args’ filter:
https://github.com/scribu/wp-posts-to-posts/wiki/Admin-box-filters
Forum: Plugins
In reply to: [Posts 2 Posts] Feature suggestion: Buddypress Groups ConnectionAs long as each group definition is stored as a row in the database somewhere, it should be possible. If groups are defined as a custom post type, it’s even easier.
If someone wants to take a stab at this, I’m willing to help them along.