Skip to content

Instantly share code, notes, and snippets.

View grtaylor2's full-sized avatar

Greg Taylor grtaylor2

View GitHub Profile
@grtaylor2
grtaylor2 / gist:7895603
Created December 10, 2013 18:32
Google Analytics Actions For Conversions
/*Add This Code To Site's Head*/
<scripttype="text/javascript"]]> var _gaq = _gaq ||[]; _gaq.push(['_setAccount','UA-XXXXX-X']); _gaq.push(['_trackPageview']); (function(){ var ga = document.createElement('script'); ga.type ='text/javascript'; ga.async =true; ga.src =('https:'== document.location.protocol ?'https://ssl':'http://www')+'.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })();</script>
Replace UA-XXXXX-X with site's Google Analytics Code
Go To Google Analytics > Conversions > Goal URLS > Create Event
Select Custom
Set Goal Detail's Category, Action & Label
@grtaylor2
grtaylor2 / functions.php
Created April 10, 2018 19:18
How to Add a Login/Logout Link to Your WordPress Genesis
<?php // add everything except for this opening line to your functions file
add_filter( 'wp_nav_menu_items', 'sp_add_loginout_link', 10, 2 );
function sp_add_loginout_link( $items, $args ) {
// Change 'primary' to 'secondary' to put the login link in your secondary nav bar
if ( $args->theme_location != 'primary' )
return $items;
if ( is_user_logged_in() ) {
$items .= '<li class="menu-item"><a href="'. wp_logout_url() .'">Log Out</a></li>';
} else {
$items .= '<li class="menu-item"><a href="'. site_url('wp-login.php') .'">Log In</a></li>';