• Resolved TiagoPires

    (@tiasch)


    Trying to list the New Zealand Staff from blog 1 into blog 2. The code bellow is almost there, the problem is that it gets all the staff and seams to ignore the taxonomy parameter

    <?php
    global $switched;
    switch_to_blog(1); //switched to main blog
    
    // Get latest Post
    $staff = query_posts(array(
    	'post_type' => 'staff',
    	'posts_per_page' => -1,
    	'destination' => 'nova-zelandia'
    	)
    );
    ?> 
    
    <?php if ( have_posts()) : ?>
    <ul class="posts">
    	<?php while ( have_posts() ) : the_post(); ?>
    		<li><?php the_title(); ?></li>
    	<?php endwhile; wp_reset_query(); ?>
    </ul>
    <?php endif; ?>
    
    <?php restore_current_blog(); //switched back to main site ?>

    an I missing any global variable or some other trick? Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter TiagoPires

    (@tiasch)

    Note that I tested the same query from inside blog 1 index.php and it works as intended. It only does not work from within blog 2 index.php

    Thread Starter TiagoPires

    (@tiasch)

    It works now! I registered the taxonomy in both blogs event if there is no post-type associated to it in the blog 2.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Get Posts from main Blog limited by post-type and term’ is closed to new replies.