Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

wp_reset_postdata() does not seem to work here.

I'm building a custom tag archive template, which should feature results from different post types in diferent boxes.

    <?php
$query_stringa= $query_string .'&post_type=recomendados';
echo $query_stringa;
$recs = new WP_Query($query_stringa);
while ($recs->have_posts()) : $recs->the_post(); 
$ids[] = get_the_ID();
the_title();
the_content();
the_tags();
echo get_post_type( get_the_ID() );
echo '<hr>';
endwhile;
wp_reset_query();
?>

<?php
wp_reset_query();
$query_stringb= $query_string .'&post_type=documentos-iae';
echo $query_stringb;
$recsa = new WP_Query($query_stringb);
while ($recsa->have_posts()) : $recsa->the_post(); 
$ids[] = get_the_ID();
the_title();
the_content();
the_tags();
echo get_post_type( get_the_ID() );
echo '<hr>';
endwhile;
?>

A have even abused of wp_reset_query, but the results in both loops are the same (and do not even result from the params of the first one).

When I echo both query strings, they seem to be OK (tag=electricidad&post_type=recomendados and tag=electricidad&post_type=documentos-iae)

thanks

share|improve this question
    
Your code seems ok... Can you make some simpler custom query work, without involving $query_string ? –  Rarst Jun 4 '13 at 21:20
    
Yes, @Rarst, but I need that $query_string, in order to 'inherit' the main query's tag parameter... Any other option for doing that? –  Lcarato Jun 6 '13 at 1:09
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.