Skip to content

Instantly share code, notes, and snippets.

@tjtate
tjtate / gist:31626d69755f350ec649
Last active August 29, 2015 14:00
Google Universal Analytics Primary and Secondary Tracking Code
//
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
/**
The afga class is used to handle all custom google analytics tracking across all web properties
<?php
$totalRight = 10;
$passThreshold = 16;
if ($totalRight >= $passThreshold) { ?>
<script>
window.location = "http://gizoogle.com";
</script>
<?php
public function content() {
global $af_theme, $post;
$subscribed = $af_theme->has_access( $this->pubcode );
$new_label = ( $af_theme->is_new( get_the_date() ) ) ? '<span class="new">New</span>' : '';
$this->pub = $pub = new WP_Query( array( 'post_type' => 'af_product', 'posts_per_page' => 1, 'meta_key' => 'pubcode', 'meta_value' => $this->pubcode ) );
if( $pub->have_posts() ) :
while( $pub->have_posts() ) : $pub->the_post();
// Stash for later
<?php
global $wpdb;
//get all articles
$articlecount = $wpdb->get_results( 'SELECT COUNT(ID) AS total_posts FROM wp_posts WHERE post_status = "publish"' );
$articlecount = $articlecount[0]->total_posts;
$sql_limit = 200;
<form action="post.php" type="post">
<input type="text" name="firstname" value="first name" />
<input type="submit" value="submit">
</form>
<!---on the post.php page -->
<?php echo $_GET['firstname']; ?>
<!--OR if you need some logic-->
<?php
private function getGoogleData($customerIDDim, $customerNumber, $value) {
$params = array(
'metrics' => $value[1],
'dimensions' => $value[0],
'filters' => $customerIDDim.'=='.$customerNumber,
);
$results = $this->googleAuth->_query($params);
@tjtate
tjtate / gist:0e446c059f0beed59511
Last active August 29, 2015 14:17
CSS3 columns
<ul class="list-column-2">
<li><a href="">How do I unsubscribe?</a></li>
<li><a href="">How do I remove my subscription from automatic renewal?</a></li>
<li><a href="">How can I the find the expiration date of my subscription?</a></li>
<li><a href="">What is my refund policy?</a></li>
<li><a href="">What is my username and password?</a></li>
<li><a href="">What is Jim Rickards' Strategic Intelligence?</a></li>
<li><a href="">Does my subscription come with an automatic renewal option?</a></li>
<li><a href="">When will I be charged for automatic renewal?</a></li>
<li><a href="">How and when will my money be returned to me?</a></li>
<div class="site-content large-8 columns" role="main">
<div class="error-search row">
<div class="large-12 columns">
<h1>The page your trying to reach doesn't exist.</h1>
<div class="panel">
<p>Search in the box below, or selecting an option from the menu above.</p>
<form><input type="text" class="site-search" name="s" value="" placeholder="Enter Search Term Here"><input type="submit" class="button small rounded mag-glass" value=""></form>
</div>
$counter = 0;
$ref_month = '';
$monthly = new WP_Query(array('posts_per_page' => 10));
if( $monthly->have_posts() ) : while( $monthly->have_posts() ) : $monthly->the_post();
if( get_the_date('mY') != $ref_month ) {
if( $ref_month ) echo "\n".'</ul>';
echo "\n".'<h6>'.get_the_date('F').'</h6>';
echo "\n".'<ul>';
$ref_month = get_the_date('mY');
if(preg_match('/(?i)msie [1-8]/',$_SERVER['HTTP_USER_AGENT']))
{
echo '<link rel="stylesheet" href="'.site_url( 'dr-content/themes/dr' ) . '/css/main.css?ver='.$versionNum.'" type="text/css" media="all" />';
}
else {
wp_enqueue_style( 'dr-main-css', site_url( 'dr-content/themes/dr' ) . '/css/main.css', array(), $versionNum );
}