Trouble with loop
-
Hi,
I’ve set up a connection type ‘team_to_project’, in the single team view the connection works fine. Now I’m trying to run it in the archive page. Same code from single view (replacing get_queried_object() by $post) isn’t working.
Switched to each_connected as written in Wiki. This is my code in the loop:p2p_type( 'team_to_project' )->each_connected( $wp_query); foreach ( $post->connected as $post ) : setup_postdata( $post ); the_title(); endforeach; wp_reset_postdata(); // set $post back to original post
Using p2p Version 1.4.3 and murmur theme, running it in archive_team.php
I am stuck and appreciate any help.
Registration:
function my_connection_types() { p2p_register_connection_type( array( 'name' => 'team_to_project', 'from' => 'team', 'to' => 'project', 'admin_column' => 'any', 'admin_box' => 'any', 'reciprocal' => true, // the relation has no hierarchy 'sortable' => 'any', ) ); } add_action( 'init', 'my_connection_types' );
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Trouble with loop’ is closed to new replies.