northpen
Forum Replies Created
-
Forum: Networking WordPress
In reply to: Getting Post Meta Data on a Custom Query Across All BlogsHey James,
That’s an interesting idea. I’ll keep that in mind when I do some benchmarking.
Right now I am planning on doing a cache of that page probably once per day. I’ll see how that works out
Forum: Networking WordPress
In reply to: Getting Post Meta Data on a Custom Query Across All BlogsAhhhh! Got it working!
Changed my date to be first in the array and added a simple sort method. I hope this helps someone. I’ll write up a detailed blog post on it later on if it will help anyone.
<?php $postArray = array(); $blog_list = get_blog_list( 0, 'all' ); foreach ($blog_list AS $blog){ switch_to_blog($blog['blog_id']); $posts = $wpdb->get_col( "SELECT ID FROM wp_".$blog['blog_id']."_posts WHERE post_type = 'sp_events'"); foreach($posts as $post){ $postdetail=get_blog_post($blog['blog_id'],$post); setup_postdata($postdetail); $postIndex = array( 'start_date' => get_post_meta($postdetail->ID, "_EventStartDate", $single = true), 'title' => $postdetail->post_title, 'content' => $postdetail->post_content ); array_push($postArray, $postIndex); $display--; } } ?> <?php asort($postArray); ?> <?php foreach($postArray as $key => $value) { print "$key: $value<br>"; foreach($postArray[$key] as $K => $v){ print "$k: $v<br>"; } } ?>
Forum: Networking WordPress
In reply to: Getting Post Meta Data on a Custom Query Across All BlogsGreene.md – The following below is what I have so far. I have it displaying all my posts but I haven’t gotten to the point of being able to sort everything by my event date.
If anyone knows how to do that, I’d appreciate it.
Code so far:
<?php $postArray = array(); $blog_list = get_blog_list( 0, 'all' ); foreach ($blog_list AS $blog){ switch_to_blog($blog['blog_id']); $posts = $wpdb->get_col( "SELECT ID FROM wp_".$blog['blog_id']."_posts WHERE post_type = 'sp_events'"); foreach($posts as $post){ $postdetail=get_blog_post($blog['blog_id'],$post); setup_postdata($postdetail); $postIndex = array( 'title' => $postdetail->post_title, 'content' => $postdetail->post_content, 'start_date' => get_post_meta($postdetail->ID, "_EventStartDate", $single = true) ); array_push($postArray, $postIndex); $display--; } } ?> <?php $mylist = array(); foreach($postArray as $key => $value) { print "$key: $value<br>"; foreach($postArray[$key] as $K => $v){ print "$k: $v<br>"; } } ?>
It outputs something like the following, which is close. Now I just gotta get it sorting correctly
0: Array : Singles Event : Awesome : 2010-07-15 00:00:00 1: Array : Auto Draft : : 2: Array : Concert of Test : Concert of Test event goes here! : 2010-07-08 00:00:00 3: Array : TEST EVENT : : 2010-09-13 00:00:00 4: Array : Testing Event System : This is where the event system goes : 2010-08-05 00:00:00
Forum: Networking WordPress
In reply to: Getting Post Meta Data on a Custom Query Across All BlogsAh perfect. Cheers man!
Forum: Networking WordPress
In reply to: Getting Post Meta Data on a Custom Query Across All BlogsHey James,
If I do that method, can I still list all my posts sorted by “Event Date” (meta key)?
I guess it could work if I used that method, put each post into an array and then displayed the whole list. Think that would work?
Forum: Plugins
In reply to: [Plugin: The Events Calendar] Global wpmu events?I’m in the same boat. has anyone figured this out?
Forum: Fixing WordPress
In reply to: Pulling From Multiple BlogsEither would be fine at this point. I’m trying to pull all blog posts.
Forum: Fixing WordPress
In reply to: Pulling From Multiple BlogsAnyone?