Ludovic
unread,Mar 9, 2013, 5:18:20 AM3/9/13Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to magic-...@googlegroups.com
Hello everyone,
i have a group called "contenu_1" and in this group, 2 related type fields ("contenu_1_selectionner_larticle" & "contenu_1_selectionner_lactivite")
which can be duplicated. The related types fields should retrieve the
number of the related post so that i could use wp_query to display the
tittle of each one. But infortunately, this retrieve only the first post
title, but not the one in the second wp_query.
This is the code :
<?php
$values = get_group('contenu_1');
foreach($values as $value){
// The Query
$the_query = new WP_Query( 'p=' . $value['contenu_1_selectionner_larticle'][1] );
// The Loop
while ( $the_query->have_posts() ) :
$the_query->the_post();
echo '<li>' . get_the_title() . '</li>';
endwhile;
// Restore original Post Data
wp_reset_postdata();
/* The 2nd Query (without global var) */
$query2 = new WP_Query( 'p=' . $value['contenu_1_selectionner_lactivite'][1] );
// The 2nd Loop
while( $query2->have_posts() ):
$query2->next_post();
echo '<li>' . get_the_title( $query2->post->ID ) . '</li>';
endwhile;
// Restore original Post Data
wp_reset_postdata();
}
?>
Anyone could advice me. Thanks !