Skip to content

Commit 85d2b79

Browse files
committed
All sites: Added support for site-specific ads.
1 parent 51c6d17 commit 85d2b79

File tree

4 files changed

+26
-4
lines changed

4 files changed

+26
-4
lines changed

config.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,12 @@
5959

6060
define( 'JQUERY_LIVE_SITE', $live_site );
6161

62+
list( $live_domain ) = explode( '/', JQUERY_LIVE_SITE, 2 );
63+
define( 'JQUERY_LIVE_DOMAIN', $live_domain );
64+
6265
$blog_id = $sites[ $live_site ]['blog_id'];
6366
define( 'COOKIE_DOMAIN', $sites[ $live_site ]['cookie_domain'] );
64-
unset( $sites, $live_site, $first_path_segment ); // Leave $blog_id.
67+
unset( $sites, $live_site, $live_domain, $first_path_segment ); // Leave $blog_id.
6568

6669
if ( defined( 'MULTISITE' ) && ! MULTISITE )
6770
die( "Remove define( 'MULTISITE', false ); from wp-config.php. Maybe check out jquery-wp-content/wp-config-sample.php for the current sample." );

mu-plugins/_loader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
list( $live_domain ) = explode( '/', JQUERY_LIVE_SITE, 2 );
3+
list( $live_domain ) = JQUERY_LIVE_DOMAIN;
44
if ( 0 === validate_file( $live_domain ) ) {
55
foreach ( (array) glob( dirname( __FILE__ ) . "/$live_domain/*.php" ) as $domain_specific_file ) {
66
require_once( $domain_specific_file );

themes/jquery/header.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<!--[if IE 8 ]> <html class="no-js ie ie8 lte8 lte9" <?php language_attributes(); ?>> <![endif]-->
44
<!--[if IE 9 ]> <html class="no-js ie ie9 lte9>" <?php language_attributes(); ?>> <![endif]-->
55
<!--[if (gt IE 9)|!(IE)]><!--> <html class="no-js" <?php language_attributes(); ?>> <!--<![endif]-->
6-
<head>
6+
<head data-live-domain="<?php echo JQUERY_LIVE_DOMAIN; ?>">
77
<meta charset="utf-8">
88
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
99

themes/jquery/js/main.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,28 @@ $(function() {
2828

2929
// Banner ads
3030
(function() {
31+
32+
// Default site id
33+
var siteId = 53829,
34+
35+
// Sites can contain two properties: all and homepage
36+
site = ({
37+
"jquery.com": {
38+
homepage: 32018
39+
}
40+
})[ $( "head" ).attr( "data-live-domain" ) ];
41+
42+
if ( site ) {
43+
if ( location.pathname === "/" && site.homepage ) {
44+
siteId = site.homepage;
45+
} else if ( site.all ) {
46+
siteId = site.all;
47+
}
48+
}
49+
3150
window.ados = {
3251
run: [function() {
33-
ados_add_placement( 5449, 32018, "broadcast", 1314 );
52+
ados_add_placement( 5449, siteId, "broadcast", 1314 );
3453
ados_load();
3554
}]
3655
};

0 commit comments

Comments
 (0)