[wp-edu] Plugin to group posts across a subset of sites?
Martha Burtis (mburtis)
mburtis at umw.edu
Fri Sep 28 14:42:24 UTC 2012
I'd recommend using the Sitewide Tags plugin (http://wordpress.org/extend/plugins/wordpress-mu-sitewide-tags/) to create a Tags blog. This will, essentially, repost every public post in one place, maintaining information about the original author and permalink. Then you can grab a feed of the tag/category from the Tags blog. We use this at UMW to aggregate posts from around our entire multisite installation that use a particular course tag/category.
Beware of the switch_to_blog function -- it's all but deprecated and can cause performance issues.
HTH,
Martha
On Sep 28, 2012, at 8:50 AM, Jonathan Cox wrote:
Check out http://codex.wordpress.org/Function_Reference/switch_to_blog and http://codex.wordpress.org/Class_Reference/WP_Query#Tag_Parameters
I'd do something like
foreach ( $blog_ids as $blog ) :
switch_to_blog( $blog );
$the_query = new WP_Query( 'tag=whatever-tag' );
while ( $the_query->have_posts() ) :
$the_query->the_post();
sprintf( '<h1><a href="%s">%s</a></h1>', get_permalink(), get_the_title() );
// more the_loop stuff here if you want
endwhile;
endforeach;
The initial blog would need to be restored after the foreach block, but I can't say offhand if restore_current_blog() will restore it or the penultimate blog.
It obviously becomes less efficient the more blogs you switch to and the more posts you pull.
Jonathan Cox
VCU Webmaster
Technology Services
(804) 827-0067
On Sep 27, 2012, at 10:18 AM, Grogan, David wrote:
Hello all,
Does anyone have a solution for this use case?
Given a subset of sites in our multi-site instance of WordPress, list the posts across those sites that have been specific tag or category.
Thanks,
David
--------------------------------------------------------------
David Grogan
Senior Solutions Specialist
Educational & Scholarly Technology Services (ESTS)
University Information Technology (UIT) Tufts University
108 Bromfield Rd
Somerville, MA 02144
Phone: 617.627.2859
Fax: 617.627.3082
http://uit.tufts.edu/at/
http://sites.tufts.edu/davidgrogan
_______________________________________________
wp-edu mailing list
wp-edu at lists.automattic.com<mailto:wp-edu at lists.automattic.com>
http://lists.automattic.com/mailman/listinfo/wp-edu
_______________________________________________
wp-edu mailing list
wp-edu at lists.automattic.com<mailto:wp-edu at lists.automattic.com>
http://lists.automattic.com/mailman/listinfo/wp-edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.automattic.com/pipermail/wp-edu/attachments/20120928/ba7f7526/attachment.htm>
More information about the wp-edu
mailing list