/*Multisite config*/
define( 'MULTISITE', true );
define( 'SUBDOMAIN_INSTALL', false );
$base = '/';
define( 'PATH_CURRENT_SITE', '/' );
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 );
define( 'SUNRISE', 'on' ); //Setting from Domain Mapping Plugin
<VirtualHost; *:80>
AddDefaultCharset UTF-8
DocumentRoot "/www/blogs"
ServerName blogs.shawconnect.ca
ServerAlias blog.slice.ca
ServerAlias blog.etcanada.com
ServerAlias blog.movietime.ca
SetEnv APPLICATION_ENV dev
<Directory; "/www/blogs">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
<IfModule; mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]
RewriteRule . index.php [L]
</IfModule>
</Directory>
ErrorLog /var/log/apache2/sm-error.log
CustomLog /var/log/apache2/sm-access.log combined
LogLevel warn
</VirtualHost>
function get_blog_name_by_id( $blog_id = ''){
if( $blog_id == ''){ global $blog_id; }
switch ( $blog_id ){
case 2:
$blog_name = 'blog-sitename1';
break;
case 3:
$blog_name = 'blog-sitename2';
break;
case 4:
$blog_name = 'blog-sitename3';
break;
....
default:
$blog_name = '';
break;
}
return $blog_name;
}
<?php global $blog_id;
$blog_name = get_blog_name_by_id($blog_id);
if(!isset($class)){ $class =''; }
$class .= ' '.$blog_name;
?>
<body <?php body_class($class); ?>>
<div id="header" class="header-<?php echo $blog_name; ?>">
<?php if( $blog_name == 'blog-sitename1'): /*sitename1 blog header goes here */?>
<div id="logo">
<a href="/" title="home">
<img src="<?php echo get_bloginfo('template_directory');?>/images/sitename1-logo.png"/>
</a>
</div>
//global
add_image_size('recent-posts-image', 50, 50, true);
add_image_size('featured-image', 600, 0, true);
add_image_size('related-posts-image', 180, 110, true);
add_image_size('slider-image', 650, 400, true);
add_image_size('sm-featured-widget-image', 140, 100, false);
if( $blog_id != 8 ){
add_image_size('archive-image', 293, 150, true);
}
if( $blog_id == 8 ){
add_image_size('archive-image', 293, 150, false);
add_image_size('sm-featured-image', 630, 232, false);
add_image_size('sm-carousel', 298, 211, true);
}
if( $blog_id == 9 ){
add_image_size('sm-home-image', 150, 170, false);
}
// Include widgets
include_once('widgets/widgets.php');
//global
include_once('sm_category_widget.php');
include_once('sm_link_widget.php');
global $blog_id;
//specific
if( $blog_id == 8 || $blog_id == 9 ){
include_once('sm_featured_widget.php');
include_once('sm_feed_widget.php');
}
add_action('widgets_init', 'widget_sm_featured_load');
function widget_sm_featured_load(){
register_widget('SM_Featured_Widget');
}
class SM_Featured_Widget extends WP_Widget {
function SM_Featured_Widget() {
....
<?php get_header();
global $blog_id;
$blog_name = get_blog_name_by_id( $blog_id );
?>
<?php if ($blog_name == 'blog-sitename8') : ?>
<div class="sitename8-feature-slider">
<?php echo get_touchcarousel('1'); ?>
</div>
<?php endif; ?>
<div class="<?php echo str_replace('blog-','',$blog_name);?>-wrapper mod">
<div id="main" class="main-<?php echo $blog_name; ?>">
....
<?php if(get_option('pyre_home_style') == 'blog'): ?>
<?php if ($blog_name == 'blog-sitename1') : ?>
<?php while(have_posts()): the_post(); ?>
<div id="post-wrapper" <?php post_class('home-post-wrapper'); ?>>
....
<?php elseif( $blog_name == 'blog-sitename9'): ?>
<?php while(have_posts()): the_post(); ?>
<div id="post-wrapper" <?php post_class('home-post-wrapper'); ?>>
<div id="post">
function get_disqus_shortname( $blog_id ){
if( !isset ( $blog_id ) ){ global $blog_id; }
switch( $blog_id ){
case 8:
$disqus_shortname = 'site1disqusid';
break;
case 9:
$disqus_shortname = 'site2disqusid';
break;
...
default:
$disqus_shortname = 'portaldisqusid';
break;
}
return $disqus_shortname;
}
<?php
global $blog_id;
$disqus_shortname = get_disqus_shortname( $blog_id );
$addthis_pubid = get_addthis_publid( $blog_id );
$disqus_category = get_disqus_category( $blog_id );
?>
<script type="text/javascript">
var disqus_shortname = '<?php echo $disqus_shortname; ?>';
var addthis_pubid = '<?php echo $addthis_pubid; ?>';
<?php if(isset($disqus_category) && $disqus_category != ''):?>>
var disqus_category_id = '<?php echo $disqus_category;?>';
<?php endif;?>
</script>
<?php wp_footer(); ?>
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
<?php
global $blog_id;
global $api_key;
global $disqus_shortname;
$disqus_shortname = get_disqus_shortname( $blog_id );
$api_key = get_disqus_api_key( $blog_id );
$disqus_category = get_disqus_category( $blog_id );
$blog_name = get_blog_name_by_id( $blog_id );
if($show_popular_posts == 'true'):
?>
<div id="tab2" class="tab_content">
<div id="recentcomments" class="dsq-widget">
<?php if(isset($disqus_category) && $disqus_category != ''){
$url = 'https://disqus.com/api/3.0/posts/list.json?api_key='.$api_key.'&category='.$disqus_category.'&related=thread&limit=5&forum='.$disqus_shortname;
}else{
$url = 'https://disqus.com/api/3.0/posts/list.json?api_key='.$api_key.'&related=thread&limit=5&forum='.$disqus_shortname;
}
$json = file_get_contents($url);
$json_array = json_decode($json, true);
if(count($json_array['response']) > 0):?>
<ul class="dsq-widget-list">
<?php foreach( $json_array['response'] as $comment ): ?>
<?php $is_published = get_post_by_link($comment['thread']['link']);?>
<?php if($is_published !== FALSE):?>
<li class="dsq-widget-item">
<a class="dsq-widget-user" href="<?php $comment['author']['profileUrl'];?>"><?php echo $comment['author']['name'];?></a>
<span class="dsq-widget-comment">
<?php echo $comment['message'];?></span>
<p class="dsq-widget-meta">
<a href="<?php echo $comment['thread']['link'];?>"><?php echo $comment['thread']['title'];?></a>
<a href="<?php echo $comment['url'];?>"><?php echo time_from_now(date($comment['createdAt']));?></a>
</p>
</li>
<?php endif;?>
<?php endforeach;?>
</ul>
<?php endif;?>
</div>
</div>
<?php
$addthis_pubid = get_addthis_publid( $blog_id );
?>
<script type="text/javascript">
var addthis_pubid = '<?php echo $addthis_pubid; ?>';
</script>
var b = $('body').attr('class');
var c = b.substring(b.indexOf('blog-'));
if(c != 'blog-sitename8' && c != 'blog-sitename9'){
(function () {
var s = document.createElement('script'); s.async = true;
s.type = 'text/javascript';
s.src = 'http://s7.addthis.com/js/250/addthis_widget.js#pubid=' + addthis_pubid + '&domready;=1&async;=1';
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
}());
}
<?php if($blog_name != ...): //condition for blogs with addThis ?>
<?php if(
get_option('pyre_twitter') == 'On' ||
get_option('pyre_facebook') == 'On' ||
get_option('pyre_google') == 'On'
): ?>
<div class="addthis_bar addthis_bar_vertical addthis_bar_large post-share">
<div class="addthis_toolbox addthis_default_style">
<?php if(get_option('pyre_twitter') == 'On'): ?>
<span>
<a class="addthis_button_tweet" tw:count="vertical" tw:text='<?php the_title(); ?>' tw:url='<?php the_permalink(); ?>'></a>
</span>
<?php endif; ?>
<?php if(get_option('pyre_facebook') == 'On'): ?>
<span>
<a class="addthis_button_facebook_like" fb:like:layout="box_count" fb:like:href="<?php echo urlencode(get_permalink($post->ID)); ?>"></a>
</span>
<?php endif; ?>
...
<?php if(
get_option('pyre_twitter') == 'On' ||
get_option('pyre_facebook') == 'On' ||
get_option('pyre_google') == 'On'
): ?>
<div class="sitename9-share mod">
<?php if (get_option('pyre_facebook') == 'On'): ?>
<div class='facebook-share share-widget'>
<iframe src="//www.facebook.com/plugins/like.php?href=<?php echo urlencode(get_permalink($post->ID));?>&send=false&layout=button_count&width=46&
show_faces=true&action=like&colorscheme=light&font=arial&height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:80px; height:65px;" allowTransparency="true"></iframe>
</div>
<?php endif; ?>
<?php if (get_option('pyre_twitter') == 'On'): ?>
<div class='twitter-share share-widget'>
<a href="http://twitter.com/share" class="twitter-share-button" data-text='<?php the_title(); ?>' data-url='<?php the_permalink(); ?>' data-count="horizontal">Tweet</a>
<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
...
<?php global $ad_rand;
$ad_rand = mt_rand() + 1;
?>
<div class="ads-wallpaper">
<?php if ($blog_name == 'blog-sitename8'): ?>
<SCRIPT type=text/javascript src="http://ad.ca.doubleclick.net/N6872/adj/clientname/blogs;sz=1x1;kw=id8;pr=id8;ck=blogs;tile=2;
ord=<?php echo $ad_rand;?>"></SCRIPT>
...
<?php else: //sub-dir blogs ?>
<SCRIPT type=text/javascript src="http://ad.ca.doubleclick.net/N6872/adj/clientname/blogs/<?php echo str_replace('blog-', '', $blog_name);?>;sz=1x1;kw=id1;pr=id1;ck=blogs;sck=<?php echo str_replace('blog-', '', $blog_name);?>;tile=2;ord=<?php echo $ad_rand;?>"></SCRIPT>
<?php endif;?>
</div>
<?php if($blog_name == ....) { ?>
<script type="text/javascript">
document.write("<scri" + "pt type='text/javascript' src='http://.../trackingbridge/tracker.ashx?U=" + window.location + "&B=id10&SD=Blogs'></scri" + "pt>");
</script>
<?php } else if($blog_name == ...) { ?>
<script language='JavaScript' type='text/javascript' src='http://.../js/account_s_code.js'></script>
<script language='JavaScript' type='text/javascript' src='http://.../js/local_s_code.js'></script>
<script language='JavaScript' type='text/javascript'>
s.pageName='<?php echo '/blogs' . $_SERVER['REQUEST_URI'];} ?>';
s.server='<?php echo $env; ?>.domainname';
s.channel='blogs';
s.pageType='';
s.prop1='';
s.prop2='';
...
<?php endif;?>
<script language='JavaScript' type='text/javascript'><!--
if(navigator.appVersion.indexOf('MSIE')>=0)document.write(unescape('%3C')+'\!-'+'-')
//-->
</script>
<noscript><a href='http://www.omniture.com/' title='Web Analytics'><img src='http://canwest.112.2o7.net/b/ss/canwest/1/H.17--NS/0' height='1' width='1' border='0' /></a></noscript>