“…infinitely…”? Sure, with a loop. Have a look at some old code in ah_recent_posts_mu.
I wouldn’t do it on a site with a pile’o’blogs. Recent versions of WP added a new function wp_get_sites, but I haven’t paid attention to how it is being used in templates or plugins around here.
What I would do, instead of going out to get all posts, is use a plugin that collects all the posts in one site first.
http://wordpress.org/plugins/wordpress-mu-sitewide-tags/
Donncha’s plugin will create a site to aggregate all posts into one site in your network. Then the usual WordPress template functions can be used to fetch post data.
With the plugin set up you can very quickly create something like
http://en.wordpress.com/tags/
and
http://en.wordpress.com/fresh/
@david Sader thanks for reply!
When i say infinitely is that at any moment can be added a new blog to the network, then the select (a searcher) would have to look for this new blog too, my select has to be made entirely in the hand, as it is a select to search buildings, a network of real estate websites
So i just need to know what to put in the place of $wpdb-> postmeta or $wpdb-> posts that did he select in all wp_prefix_posts and wp_prefix_postmeta
I’ve got a select to do something like http://en.wordpress.com/fresh/ via this link http://www.bappi-d-great.com/wordpress-multisite-how-to-show-popular-post-acrosee-the-network-without-any-plugin
But this other i’m trying to assemble not only search posts, search custom fields in custom post types in sequence of combobox
Select Negotiation
Select type of property
Select State
Select City
Select Neighborhood
In all the network sites. So I needed to know what to use in place of this select
$sql = “SELECT DISTINCT retorno.meta_value FROM “.$wpdb->posts.”
FROM??? In all the blogs on the network..
It helps when you tell us WHY 🙂
So you want to search all sites?
http://wordpress.org/extend/plugins/multisite-global-search/
And there are others as well.
http://wordpress.org/extend/plugins/search.php?q=multisite+search
I would use that plugin and, if it’s not getting everything, fork it, rather than start from scratch.
I am extremely grateful for the replies, and my apologize for my bad English understanding of you. But I’m not looking for a search plugin, I’m trying to develop a select, search is something like the plugin mentioned but anything more specific. Let me give you an example straight down:
This select below search the posts a post whose custom field exists other than NULL, if he finds one or more, it lists within the select option. A custom post type value for trading (sale, lease, barter). DISTINCT, without repeated values and status of published ok?
<select name="negotiation" id="negotiation">
<option value="">Select the Negotiation</option>
<?php
global $wpdb;
$sql = "SELECT DISTINCT
retorno.meta_value
FROM
".$wpdb->posts." // IN ALL POSTS IN ALL NETWORK
LEFT JOIN ".$wpdb->postmeta." AS retorno ON retorno.post_id = ".$wpdb->posts.".ID // IN ALL POSTS IN ALL NETWORK
WHERE
retorno.meta_key = 'negotiation' AND
retorno.meta_value <> '' AND
".$wpdb->posts.".post_status = 'publish'
ORDER BY
retorno.meta_value ASC";
foreach($wpdb->get_results($sql, OBJECT) as $rss){
?>
<option value="<?=$rss->meta_value?>"<?php if($_GET['negotiation'] == $rss->meta_value){ ?> selected="selected"<?php } ?>><?=$rss->meta_value?></option>
<?php } ?>
</select>
The question is do they get (sale, lease, barter) throughout my network and return the value of all posts on the network that have any of the values (sale, lease, barter). If the site 1 own some post that has the custom field negotiation with any value between “sale, lease and Exchange”, it pulls, if the site 2 own some post that has the custom field negotiation with any value between “sale, lease and exchange”, it pulls..