Hi there,
I'm trying to figure out how to display posts from a specific WordPress MU blog and a specific category on the MU-homepage for the blogs. Google didn't serve me the answer this time. Any thoughts?
Thanks!
Hi there,
I'm trying to figure out how to display posts from a specific WordPress MU blog and a specific category on the MU-homepage for the blogs. Google didn't serve me the answer this time. Any thoughts?
Thanks!
Pull the category feed of that blog and parse it on the home page. :)
This'll grab the last 5 posts from category id = 1 of blog id = 2
<ul>
<?php
switch_to_blog(2); ?>
<?php $recent = new WP_Query("showposts=5&cat=1");
while($recent->have_posts()) : $recent->the_post(); ?>
<li>
\\INSERT TEMPLATE TAGS HERE
</li>
<?php endwhile ; ?>
<?php restore_current_blog();
?>
</ul>
Thanks for all replies, Klarkos method worked out fine!
I recently discovered one problem. I'm using the code below, thanks to Klarko, to display posts from a specific blog and category on the MU homepage. Works fine there. But when I move to a different page on the homepage the 'Read more' links doesn't work it displays the whole post content instead. Any thoughts on this?
This is the code I'm using atm.
Read more will only work if your users set it when they're writing their posts. So you can't depend on that. Use the_excerpt and the_permalink together instead.
@Klarko: I'm using the <!-- more --> tag on each post. The strange is that the the_content('Read more') works fine on the startpage but not on page that belongs to the startpage. The the_excerpt() works just like the_content(), fine on the startpage of the homepage but not on a page that belongs to the homepage.
Nevermind, solved it using get_the_content() and substr().