Advertisement
luisabarca

Get posts from multisite

Jul 17th, 2012
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.92 KB | None | 0 0
  1. <?php
  2. /*
  3. Template Name: Guide Loop
  4. */
  5. remove_action( 'genesis_post_content', 'genesis_do_post_content' );
  6. add_action( 'genesis_post_content', 'child_do_content' ); // Adds your custom page code/content
  7.  
  8. function child_do_content()
  9. {
  10.     $blogs_id = get_blog_list( 0, 'all' );
  11.     $allposts = array();
  12.  
  13. foreach ($blogs_id as $blog) {
  14.     // switch to blog to get posts
  15.     switch_to_blog( $blog['blog_id'] );
  16.  
  17.     $posts = get_posts('meta_key=_wp_page_template&meta_value=Profile_Template.php');
  18.  
  19.     foreach( $posts as $post ) :   
  20.         setup_postdata($post); ?>
  21.     <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
  22.         <?php echo get_post_meta(get_the_ID(), 'custom_field_1', true) ?>
  23.         <?php echo(types_render_field("first", array("raw"=>"false"))); ?>
  24.         <?php $rating = myrp_api6_get_rating() * 5; echo myrp_api_star_image($rating); ?>
  25.     <?php endforeach;
  26. }
  27. }
  28.  
  29. genesis();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement