WordPress.org

Ready to get started?Download WordPress

Forums

PHP code to display post(s) from another blog (4 posts)

  1. tirussell
    Member
    Posted 3 years ago #

    I am using WP3 Multisite as the CMS for a university, and I would like to create a page on the "For Current Students" sub-site that pulls the most recent blog entry from the "Dining Services" sub-site, which will be today's menu.

    I have the nifty Shortcode Exec PHP plugin installed, so what I now need to do is write the PHP code that will accept a sub-site name and possibly a post id as variables, and pull that post in all it's glory.

    I'm not sure where to even start with this code. Is there a chunk of code out there for pulling posts that I might use as a starting point? Other ideas?

    Any help greatly appreciated!

  2. I do it in two lines with PHP...

    <?php
    include_once(ABSPATH.WPINC.'/rss.php');
    wp_rss('http://domain.com/feed/',1);
    ?>

    Which basically calls the RSS feed and then shows the last post. Since my posts are set to show excerpts, that works for me. I got the idea from http://perishablepress.com/press/2009/04/26/import-and-display-rss-feeds-in-wordpress/

    There are also plugins that do it, but it felt like overkill to me.

  3. tirussell
    Member
    Posted 3 years ago #

    That's a really clever solution, with way less coding than I was fearing.

    However, I'm worried about the performance of this on a high-traffic page. I should have emphasized that I want to pull content from another in-network subsite, not one on a different site.

    Can you point me towards the plugins you mention? I'm looking, but I must not be using the magic search term.

  4. I haven't had any issues on a high-traffic site. I mean, no more than I would for any other plugin, I think.

    Try: http://wordpress.org/extend/plugins/wordpress-mu-featured-posts/

Topic Closed

This topic has been closed to new replies.

About this Topic