Skip to content

Instantly share code, notes, and snippets.

Greg Taylor grtaylor2

View GitHub Profile
@grtaylor2
grtaylor2 / functions.php
Created Apr 10, 2018
How to Add a Login/Logout Link to Your WordPress Genesis
View functions.php
<?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>';
@grtaylor2
grtaylor2 / gist:7895603
Created Dec 10, 2013
Google Analytics Actions For Conversions
View gist:7895603
/*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 / woocommerce.css
Created Nov 29, 2013
Clean Woo Commerce CSS -- Replace the plugin's woocommerce.css file with a decompressed formatted stylesheet. This is the original CSS with no edits -- the code is just formatted in a way that makes edits much easier.
View woocommerce.css
/*Stylesheet cleaned up and organized by Marketing Press*/
.clear {
clear:both
}
.nobr {
white-space:nowrap;
}
View Genesis Buttons
/* Color Buttons
------------------------------------------------------------ */
.button-blue,
.button-gray,
.button-green,
.button-purple,
.button-red,
.button-yellow {
color: #fff;
@grtaylor2
grtaylor2 / gist:6313917
Created Aug 22, 2013
Enable specific phone numbers on page
View gist:6313917
Add to the page or it will detect any ph# on page and make it clickable for iPhone.
<meta name="format-detection" content="telephone=no">
Then wrap specified phone number:
<a href="tel:1-800-555-5555">Anchor to any words or combo of numbers and/or letters</a>
@grtaylor2
grtaylor2 / gist:6072596
Created Jul 24, 2013
Change Default Genesis Comment Tagline "Speak Your Mind"
View gist:6072596
/* Change default comment Speak Your Mind */
function change_default_comment_text($args) {
$args['title_reply'] = 'Leave a Comment';
return $args;
}
add_filter( 'genesis_comment_form_args', 'change_default_comment_text' );
@grtaylor2
grtaylor2 / gist:5960970
Created Jul 9, 2013
Code to DELETE from home.php file to remove blog posts from Genesis Minimum home page layout.
View gist:5960970
add_action( 'genesis_loop', 'minimum_grid_loop_helper' );
function minimum_grid_loop_helper() {
if ( function_exists( 'genesis_grid_loop' ) ) {
genesis_grid_loop( array(
'features' => 0,
'feature_image_size' => 'featured',
'feature_image_class' => 'post-image',
'feature_content_limit' => 0,
'grid_image_size' => 0,
@grtaylor2
grtaylor2 / Removing Blog Post From Home Page in Genesis
Last active May 5, 2017
Removing Blog Post From Home Page in Genesis
View Removing Blog Post From Home Page in Genesis
/** Removing Blog Post From Home Page */
remove_action( 'genesis_loop', 'genesis_do_loop' );add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
genesis();
@grtaylor2
grtaylor2 / Change Read More Text Genesis WordPress
Last active Mar 5, 2019
Change the [Read More] Text in Genesis WordPress Child Theme
View Change Read More Text Genesis WordPress
/** Customize Read More Text */
add_filter( 'excerpt_more', 'child_read_more_link' );
add_filter( 'get_the_content_more_link', 'child_read_more_link' );
add_filter( 'the_content_more_link', 'child_read_more_link' );
function child_read_more_link() {
return '<a href="' . get_permalink() . '" rel="nofollow">CUSTOMIZE YOUR TEXT HERE</a>';
}
@grtaylor2
grtaylor2 / GenesisPostMeta
Last active Dec 14, 2015
Change WordPress Post Meta For Genesis Framework
View GenesisPostMeta
/** Customize the post meta function */
add_filter( 'genesis_post_meta', 'post_meta_filter' );
function post_meta_filter($post_meta) {
if ( !is_page() ) {
$post_meta = '[post_categories before="CUSTOM CATEGORY NAME"] [post_tags before="CUSTOM TAG NAME"]';
return $post_meta;
You can’t perform that action at this time.