The MU forums have moved to

Using Switch_to_blog and only first post has correct permalink (4 posts)

  1. justinshattuck
    Posted 14 years ago #

    I am currently using WPMU2.8.4a and I have created an aggregation page template that is currently used by the default root domain as its 'static' page upon loading.

    SO you visit and you get the aggro page. Inside this page template I am pulling 5 posts from each of my 18 sub-sites (blogs within WPMU same install).

    I was using the following code before without fail, in terms of it properly pulling the posts. However, now for whatever reason it only pulls the first post and permalink, then for every additional post it outputs the correct title, but doesn't pull the permalink:

    $new_loop = new WP_Query($args);
    	if($new_loop->have_posts()) {
    		while($new_loop->have_posts()) {
    			$new_loop->the_post(); ?>
    			                            <li><a href="<?php the_permalink(); ?>"><span class="date"><?php the_time('m/j/Y'); ?></span> - <?php the_title(); ?></a></li>
    <?php } } restore_current_blog(); ?>
  2. dsader
    Posted 14 years ago #

    The code you have there works perfectly for me, WPMU2.8.4a. Tried it on a couple blogs, a couple themes, all's well. Copied and pasted 18 times with 18 new blog ids and all was as expected(18 new WP_Query creates a lot of queries on a landing page IMHO)

    Now, I did get some expected results on one theme using multiple loops when I had another new WP_Query with a date limiting add_filter('posts_where'... plugin.

    Does your code above screw up on only one template or on only one blog? Do you have any other plugins, functions, or another new WP_Query, that collides?

  3. mercime
    Posted 14 years ago #

    sorry-posted to different forum, too many browsers opened :-)

  4. mikeboy3
    Posted 14 years ago #

    this post really helped me, thank you very much, it does work on WPmu 2.8.4a

About this Topic

  • Started 14 years ago by justinshattuck
  • Latest reply from mikeboy3