Plugin Author
scribu
(@scribu)
Right, so it returns a ‘formation’ post.
Therefore, only the ‘formations_to_chapitres’ query could return anything.
Will try to set it up on my test install.
if you want an access or a dump … don’t hesitate. I could share something through dropbox.
Previously, every connexion was sending back something …
maybe the way I was structuring the cascade was heretic π
If you look here, on an other install WP, the page is full with objects coming from the 3 queries
http://dev2.pointben.net/formation/iphoto-debutant
Plugin Author
scribu
(@scribu)
I meant the 3 new WP_Query calls at the top. They all use the same get_queried_object().
How can I differentiate them?
I’ve seen an example with get_queried_object_id()
I’m sorry, I’m not a dev and a poor PHP culture π
Plugin Author
scribu
(@scribu)
You don’t even use the other 2; just remove them.
I tried to replicate your setup on WP 3.4.1 and each_connected() seems to work fine.
Add var_dump( $chapitres->request ); after defining it. This should produce the raw SQL query.
Aaah OK, I see what you want to see.
I’ve added a
tag to add more readability.
And you've got 2 levels : request and then the full var
Here the previous URL
The thing I've noted is the YEAR set up to :
YEAR(wp_posts.post_date)='2525'
Here is another URL with the same date published
http://dev2.pointben.net/membres/formation/apercu-2
Plugin Author
scribu
(@scribu)
You need to upgrade to P2P 1.4.1.
And remove $Lecons and $Videos already. I told you they’re useless.
In fact I’ve downgraded to 1.3.1 because it is worst with 1.4.1
If you look here > on the sidebar in the dark grey area, you still got a list of item but no Title and no links …
Here is a simple view with a complete sidebar and the list of items below.
here on the template I’ve removed $Lecons and $Videos but I think that the structure of the code for the main template is not accurate.
Excuse me, but if I understand well (as the $Lecons and $Videos are useless), does it mean that it is not possible to handle such template?
To display parts of every object connected in this waterfall?
training -> chapters -> lessons -> videos
How could I build such queries ?
Thank you.
Plugin Author
scribu
(@scribu)
No, it means that you only need to call each_connected() – it will construct a WP_Query instance internally.
I’m having the same problems as Francois, the back-end is fine but connections are missing on the front-end.
Plugin Author
scribu
(@scribu)
The main problem in Francois’ case was that each_connected() was outputting wrapped post objects, instead of raw post objects. This is fixed in the latest development version (1.4.2-alpha2).
Thank you very much Scribu for this update.
Hi scribu,
I installed the development version and still have the same problem:
Here is my code:
The function:
function my_connection_types() {
p2p_register_connection_type( array(
'name' => 'pages_to_pages',
'from' => 'page',
'to' => 'page',
'reciprocal' => true,
'sortable' => 'any'
) );
}
add_action( 'p2p_init', 'my_connection_types' );
Printing connected pages:
$connected = new WP_Query( array(
'connected_type' => 'pages_to_pages',
'connected_items' => get_queried_object(),
'nopaging' => true,
) );
// Display connected pages
if ( $connected->have_posts() ) :
?>
<h3>Related pages:</h3>
<ul>
<?php while ( $connected->have_posts() ) : $connected->the_post(); ?>
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endwhile; ?>
</ul>
<?php
// Prevent weirdness
wp_reset_postdata();
endif;
And i still get the error:
Warning: Could not find direction(s). in /public_html/wp-content/plugins/posts-to-posts/core/query-post.php on line 16