The MU forums have moved to WordPress.org

what's the best way to display content feeds (4 posts)

  1. bikerjeg
    Member
    Posted 15 years ago #

    I want to be able to display updates or the latest posts from a specific category on a members blog onto the main blog. What would be the easiest way to go about this while being able to still display custom fields from that post?

    I was going to try RSS but I don't think RSS would work with custom fields. Anyone done this before? I tried searching but all I found was plugins that allowed the main blog to display recent posts from all forums and the plugins didn't account for custom fields just text content.

  2. tdjcbe
    Member
    Posted 15 years ago #

    I'd do RSS myself but, as you noted, I don't think that would pick up the custom fields. When you checked the feed, did you see any of the information from the custom fields?

  3. Klark0
    Member
    Posted 15 years ago #

    here's what I use for this, if you want to display it for a particular blog:
    The stuff between #'s will need changing.

    Where it says showposts, you can add "&cat=#BLOGSCATID#"

    <ul>
    <?php
    switch_to_blog(#INSERT BLOGID HERE#); ?>
    <?php $recent = new WP_Query("showposts=5");
    while($recent->have_posts()) : $recent->the_post(); ?>
    <li>
    #NORMAL THEME FUNCTIONS HERE LIKE the_time, the_permalink(), the_title(), the_content AND WHATEVER CUSTOM FIELDS YOU HAVE#
    </li>
    <?php endwhile ; ?>
    <?php restore_current_blog();
    ?>
    </ul>

    I think you can probably achieve the same with the get_blog_post function. But I haven't looked at it and MU documentation is a bit flimsy.

  4. bikerjeg
    Member
    Posted 15 years ago #

    Thanks Klarko! I think I will use this method and give it a whirl.

    I was thinking about using the get_blog_post function too, but I couldn't quite understand how to use it and I tried it and did not get what I was looking for. I think your solution will definitely work for what I need.

About this Topic

  • Started 15 years ago by bikerjeg
  • Latest reply from bikerjeg