我正在使用Wordpress多站点在一个WP安装中容纳多个站点
我想有一个导航显示每个网站与该网站的链接。
我用这个函数来做这个
<?php
$bcount = get_blog_count();
global $wpdb;
$blogs = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->blogs WHERE spam = \'0\' AND deleted = \'0\' and archived = \'0\' and public=\'1\'"));
if(!empty($blogs)){
?>
<ul class="nav navbar-nav">
<li class="portalHome"><a href="dashboard.html">
<i class="fa fa-home"></i>
<i class="fa fa-chevron-right pull-right chervonMobNav"></i></a></li>
<?php
foreach($blogs as $blog){
$details = get_blog_details($blog->blog_id);
if($details != false){
$addr = $details->siteurl;
$name = $details->blogname;
if(!(($blog->blog_id == 1)&&($show_main != 1))){
?>
<li class="menu-item<?php if($counter == get_current_blog_id()){ echo \' current-menu-item\';}?>">
<a href="<?php echo $addr; ?>"><?php echo $name;?> <i class="fa fa-chevron-right pull-right chervonMobNav"></i></a>
</li>
<?php
}
}
}
?></ul><?php
}
?>
它工作正常,但我也遇到了一个错误
Warning: Missing argument 2 for wpdb::prepare()
wpdb::prepare()的第二个参数应该是什么