Support » Networking WordPress » query sub site recent blog post for main blog home page

  • I want to grab the most recent custom post type of a sub site blog and display it on the home page of the main blog. I looked at using http://wordpress.org/extend/plugins/wordpress-mu-sitewide-tags/ but that isn’t working for me (nothing is being brought to main site that I can tell).

    I was hoping to just use something like query_posts(‘blogid=2&post_type=customposttype’) but that doesn’t work either. I can get the custom post type of the main site but not the subsite post.

    Any ideas?
    Thanks!
    Tom

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    Lead Plugin Wrangler

    The posts are custom post types and not normal posts, then?

    Correct. I’m currently working on using something like:

    global $wpdb;
    $wpdb->set_blog_id(2);
    
     $querystr = "
        SELECT $wpdb->posts.*
        FROM $wpdb->posts, $wpdb->postmeta
        WHERE $wpdb->posts.ID = $wpdb->postmeta.post_id
        AND $wpdb->posts.post_status = 'publish'
        AND $wpdb->posts.post_type = 'customposttype'
        AND $wpdb->posts.post_date < NOW()
        ORDER BY $wpdb->posts.post_date DESC
    	LIMIT 1";
    
     $pageposts = $wpdb->get_results($querystr, OBJECT);

    Then looping through. However, the permalink doesn’t work the way you would think it should and I still haven’t gotten any meta data to go with it. It would be great to get the custom fields and featured image too.

    Thanks!

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    Lead Plugin Wrangler

    That makes a certain amount of sense. I know thw plugin wasn’t made to handle CPTs from inception.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘query sub site recent blog post for main blog home page’ is closed to new replies.