Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Multi site wordpress3.3 home page WordPress

  • SOLVED

Hi There,
I am looking for some help on a future project.

I am trying to make a so called splash/landing page for a wordpress3.3 Multi-site install with sub-domains. (not sub-folder) and for the root site (http://mysite.com). This will be a single page theme and can be based on the any of the wordpress default themes as a static home page if needed.

For a example of this page see a wordpress mutli-site install wp-admin/my-sites.php code ..but must display the sites to the public without being logged in..( of course no access to the wordpress admin area.(just view site) also

I also need the this splash page to have the following information per site.
1) The name (title) of the site linked to the site.( home page)
2) A description of the site from like a site tagline and/or may be a all-in-one-seo home page description
3) The site's favicon as a thumbnail.
This info will be displayed in li format and in alphabetical order ( no css help needed for the layout)

Just looking for some ideas and the code to make this happen.

Thanks

Answers (2)

2011-11-12

John Cotton answers:

Something along these lines should do it for you....


<?php
global $wpdb;

$sql = "SELECT id FROM {$wpdb->blogs} WHERE public = 1";

if( $sites = $wpdb->get_col($sql) ) {
$list = '';

foreach( $sites as $site_id ) {
$url = get_blog_option( $site_id, 'siteurl' );
$name = get_blog_option( $site_id, 'blogname' );
$desc = get_blog_option( $site_id, 'blogdescription' );


$list .= sprintf( '<li><a href="%s"><img src="%s" /> %s</a> - %s</li>', $url, $url.'favicon.png', $name, $desc );
}

echo '<ul>'.$list.'</ul>';
}

?>


You'd need to put this code on the home page of the theme for each site (I assume you want the same display for each site), but if they are sharing a theme, that won't be an issue.

The url for the favicon might change of course - for instance if you've got it in your theme - but that should be sufficient for you to get going.

JC


RNWest comments:

Hi There,

I tried this and it does appear to work so here is some more info

The site will be setup like this

domian USA.com blog_id 1 site_id 1 public 1

domain Michigan.USA.com blog_id 2 site_id 1 public 0

etc...

also does it matter that I do not use wp in $table_prefix


I look at http://wordpress.com/ homepage and saw that theydifferentt from diferent blogs so I was thing of the same set up but with just blogs.

Thanks


RNWest comments:

sorry ...does not appear to work


John Cotton comments:

Sorry, the sql line is wrong - replace it with this:

$sql = "SELECT blog_id FROM {$wpdb->blogs} WHERE public = 1";

Also, I notes that your second (Michigan) blog has public as 0. If you still want it listed, then you should have this as the SQL:

$sql = "SELECT blog_id FROM {$wpdb->blogs}";


RNWest comments:

Hi

Thanks this works perfect now..


RNWest comments:

oops,

one more question how do it get it to sort alphabetical and not by blog_id

Thanks

2011-11-12

Luis Cordova answers:

sounds like a network of site banner or splash page to me

there are interesting ways of doing these with redirects upon selection, etc.

The code hmm, will strongly depend how the mutlisite entity or taxonomy* entry is stored

you can have a CPT associated with each site so you can reuse the wp side functions and also integrate that with the multisite...

just some ideas, hope that helps