display order of connections
Yes, there is a way to do this, since version 0.8: https://github.com/scribu/wp-posts-to-posts/wiki/Connection-ordering
Yes, there is a way to do this, since version 0.8: https://github.com/scribu/wp-posts-to-posts/wiki/Connection-ordering
So after a lot of time spent and a lot of trying different things, I finally figured out the right way to do this. I used MonkeyMan Rewrite Analyzer and the WP Debug Bar to help figure out how to construct the rewrite. So first, my custom post type URLs are rewritten as such: // … Read more
Ah I think I understand. I think what you should do with your first loop, is get the connected genres as you say. Then you wish to get all events that are related to those, so you should gather only the IDs (collect them in one array) in a loop, and then use array_unique() to … Read more
This is not really a WP_Rewrite question, unless you want to include the post ID in the URL. I think the best way to solve this is, as you suggest, do a get_posts() query with your slug, and change the variables from there. Of course you don’t have to do this on every init, only … Read more
I think the simplest way to do this would be to give the users a customized Author role when they register. The capabilities of the default Author role are that they can only create and edit their own posts. You’ll have to customize this to enable capabilities for your ‘class’ custom post type, not just … Read more
No, it isn’t possible without modifications to the p2p plugin, as indicated here: https://github.com/scribu/wp-posts-to-posts/issues/374 Relevant code is here: https://github.com/scribu/wp-posts-to-posts/blob/master/core/connection-type.php#L374
I finally found the answer. Turns out I just needed a better understanding of WPQuery. It ended up being as simple as: function order_pages_by_ID( $args, $ctype, $post_id ) { if ( ‘posts_to_pages’ == $ctype->name ) { $args[‘meta_key’] = ‘_event_start_date’; $args[‘orderby’] = ‘meta_value’; $args[‘order’] = ‘asc’; } }
Just call p2p_connect( $id_of_post_type_a, $id_of_post_type_b ); in the form handling code.
Why not do… $my_post_types = array( ‘post’, ‘page’, ‘topic’, ‘case’, ‘note’, ‘question’, ‘therapy_guideline’ ); p2p_register_connection_type( array( ‘name’ => ‘my_post_relationships’, ‘from’ => $my_post_types, ‘to’ => $my_post_types, ‘sortable’ => ‘any’, ‘reciprocal’ => false, ‘cardinality’ => ‘many-to-many’, ‘title’ => array( ‘from’ => ‘Children’, ‘to’ => ‘Parent’, ), ‘admin_column’ => ‘any’, ) ); Or something similar? Edit: A way … Read more
Ok, so the idea is that you have an outer loop, that displays the tours. And then you have an inner loop, that displays each artist. The way The Loop works is that it populates a lot of global variables, such as $post, so it looks like magic. Let’s look at a more uniform approach: … Read more