This repository has been archived by the owner. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
187 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
/** | ||
* Class for adding a link tracking to the options-general.php page | ||
*/ | ||
class Add_Settings_Field { | ||
|
||
/** | ||
* Class constructor | ||
*/ | ||
public function __construct() { | ||
add_filter( 'admin_init' , array( &$this , 'register_fields' ) ); | ||
} | ||
|
||
/** | ||
* Add new fields to wp-admin/options-general.php page | ||
*/ | ||
public function register_fields() { | ||
register_setting( 'general', 'outbound_tracking', 'esc_attr' ); | ||
add_settings_field( | ||
'fav_color', | ||
'<label for="outbound_tracking">' . __( 'Track Outbound Links' , 'outbound_tracking' ) . '</label>', | ||
array( &$this, 'fields_radio' ), | ||
'general' | ||
); | ||
} | ||
|
||
/** | ||
* HTML for extra settings | ||
*/ | ||
public function fields_radio() { | ||
$value = get_option( 'outbound_tracking', '' ); | ||
echo '<input type="radio" id="outbound_tracking_no" name="outbound_tracking" value="no"'.(strlen(esc_attr( $value )) == 0 || esc_attr( $value ) == 'no'?' checked':'' ).' /> No <input type="radio" id="outbound_tracking_yes" name="outbound_tracking" value="yes"'.(esc_attr( $value ) == 'yes'?' checked':'' ).' /> Yes '; | ||
} | ||
|
||
} | ||
new Add_Settings_Field(); | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* Attach tracking to all download & external links */ | ||
var _gaq = _gaq || []; | ||
|
||
function _gaLt(event){ | ||
var el = event.srcElement || event.target; | ||
|
||
/* Loop up the tree through parent elements if clicked element is not a link (eg: an image in a link) */ | ||
while(el && (typeof el.tagName == 'undefined' || el.tagName.toLowerCase() != 'a' || !el.href)) | ||
el = el.parentNode; | ||
|
||
if(el && el.href){ | ||
if(el.href.indexOf(location.host) == -1){ /* external link */ | ||
_gaq.push(["_trackEvent", "Outgoing Links", el.href, document.location.pathname + document.location.search]); | ||
/* if target not set then delay opening of window by 0.5s to allow tracking */ | ||
if(!el.target || el.target.match(/^_(self|parent|top)$/i)){ | ||
setTimeout(function(){ | ||
document.location.href = el.href; | ||
}.bind(el),500); | ||
/* Prevent standard click */ | ||
event.preventDefault ? event.preventDefault() : event.returnValue = !1; | ||
} | ||
} | ||
|
||
} | ||
} | ||
|
||
/* Attach the event to all clicks in the document after page has loaded */ | ||
var w = window; | ||
w.addEventListener ? w.addEventListener("load",function(){document.body.addEventListener("click",_gaLt,!1)},!1) | ||
: w.attachEvent && w.attachEvent("onload",function(){document.body.attachEvent("onclick",_gaLt)}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,38 @@ | ||
<?php | ||
/** | ||
Template Name: Home | ||
* The template for displaying the homepage. | ||
* | ||
* @package cornerstone | ||
*/ | ||
$rows = get_theme_mod('homepagerows'); | ||
$count = 1; | ||
get_header(); ?> | ||
|
||
<div id="page-home"> | ||
<?php while ( have_posts() ) : the_post(); ?> | ||
<?php for($i=0; $i<$rows; $i++){ /* Begin Homepage Builder... */?> | ||
<div class="row"> | ||
<?php | ||
$widths = get_theme_mod('homepage_'.$i); | ||
$widths = explode(',',$widths); | ||
foreach($widths as $width){ | ||
if($width == 0) break; | ||
?> | ||
<div class="col-sm-<?php echo $width; ?>"> | ||
<div class="home-section" id="home-section-<?php echo $count; ?>"> | ||
<?php if ( is_active_sidebar( 'home'.$count ) ) { ?> | ||
<?php dynamic_sidebar( 'home'.$count ); ?> | ||
<?php } else { ?> | ||
<?php }; ?> | ||
</div> | ||
</div> | ||
<?php $count ++; } ?> | ||
</div> | ||
<!-- /row--> | ||
<?php } /* ... end Homepage Builder */?> | ||
<?php endwhile; // end of the loop. ?> | ||
</div> | ||
<?php get_footer(); ?> | ||
<?php | ||
/** | ||
Template Name: Home | ||
* The template for displaying the homepage. | ||
* | ||
* @package cornerstone | ||
*/ | ||
$rows = get_theme_mod('homepagerows'); | ||
$count = 1; | ||
get_header(); ?> | ||
|
||
<div id="page-home"> | ||
<?php while ( have_posts() ) : the_post(); ?> | ||
<?php for($i=0; $i<$rows; $i++){ /* Begin Homepage Builder... */?> | ||
<div class="row"> | ||
<?php | ||
$widths = get_theme_mod('homepage_'.$i); | ||
$widths = explode(',',$widths); | ||
if(count($widths) == 1) $widths[0] = 12; | ||
foreach($widths as $width){ | ||
if($width == 0) break; | ||
?> | ||
<div class="col-sm-<?php echo $width; ?>"> | ||
<div class="home-section" id="home-section-<?php echo $count; ?>"> | ||
<?php if ( is_active_sidebar( 'home'.$count ) ) { ?> | ||
<?php dynamic_sidebar( 'home'.$count ); ?> | ||
<?php } else { ?> | ||
<?php }; ?> | ||
</div> | ||
</div> | ||
<?php $count ++; } ?> | ||
</div> | ||
<!-- /row--> | ||
<?php } /* ... end Homepage Builder */?> | ||
<?php endwhile; // end of the loop. ?> | ||
</div> | ||
<?php get_footer(); ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.