WordPress.org

Ready to get started?Download WordPress

Forums

AStickyPostOrderER
AStickyPostOrderER breaks switch_to_blog query (1 post)

  1. mistercyril
    Member
    Posted 3 years ago #

    Hello,

    This plugin installs perfectly but breaks my custom query for posts from an other blog in my WordPress 3 Network setup.

    Here is the code I use to retrieve the latest post from blog number 2 :

    Functions.php

    function get_latest_blogpost_wpnetwork($blog_id,$show){
    	wp_reset_query();
    	switch_to_blog($blog_id);
    	global $post;?>
    	<?php $my_query = new WP_Query('showposts='.$show.'&order=DSC');
    	while ($my_query->have_posts()) : $my_query->the_post();
    	    $do_not_duplicate = $post->ID; ?>
    
    	<?php endwhile; ?>
    	<?php restore_current_blog();
    }

    Index.php
    `<?php
    echo get_latest_blogpost_wpnetwork('2','1');
    ?>`

    Does anybody know why AStickyPostOrderER would break this?
    The page doesn't show any errors, it just displays without said post.

    I would really appreciate your help with this.

    Thanks,
    C.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic