Skip to content

Instantly share code, notes, and snippets.

@nathaningram
nathaningram / gist:3675d231574174810909
Created May 11, 2015 13:35
The Incredible Shrinking Header - jQuery
jQuery(function( $ ){
$(window).scroll(function () {
if ($(document).scrollTop() > 200 ) {
$('.builder-module-1-background-wrapper').addClass('shrink');
} else {
$('.builder-module-1-background-wrapper').removeClass('shrink');
}
});
@nathaningram
nathaningram / gist:f1ac3f88a357a05d321d
Last active August 29, 2015 14:20
The Incredible Shrinking Header - PHP Function
//* Enqueue Scripts
add_action( 'wp_enqueue_scripts', 'ni_shrinking_header_script' );
function ni_shrinking_header_script() {
wp_enqueue_script( 'shrinking-header', get_bloginfo( 'stylesheet_directory' ) . '/js/shrinking-header.js', array( 'jquery' ), '1.0.0', true );
}
@nathaningram
nathaningram / gist:3daedafa11bfc72a6a77
Created May 11, 2015 15:40
The Incredible Shrinking Header - CSS
/*********************************************
Incredible Shrinking Header CSS
*********************************************/
/* Sticky Top Module */
.builder-module-1-background-wrapper {
background: #15384E;
position: fixed;
width: 100%;
@nathaningram
nathaningram / gist:965628501dff4eb241e3
Created June 8, 2015 15:36
Prefill Gravity Form with User Data
// Prefill Gravity Form with User Data
function populate_usermeta($meta_key){ global $current_user;
return $current_user->__get($meta_key);
}
add_filter('gform_field_value_userfirstname', create_function("", '$value = populate_usermeta(\'user_firstname\'); return $value;' ));
add_filter('gform_field_value_userlastname', create_function("", '$value = populate_usermeta(\'user_lastname\'); return $value;' ));
add_filter('gform_field_value_useremail', create_function("", '$value = populate_usermeta(\'user_email\'); return $value;' ));
add_filter('gform_field_value_userwebsite', create_function("", '$value = populate_usermeta(\'user_url\'); return $value;' ));
@nathaningram
nathaningram / gist:43ef5b3b1882e0412cbe
Created June 8, 2015 15:42
User First Name Shortcode
// First Name of Logged In User Shortcode
function ni_firstname() {
$user = wp_get_current_user();
$firstname = $user->user_firstname;
return $firstname;
}
add_shortcode('firstname', 'ni_firstname');
@nathaningram
nathaningram / gist:234d1063553cafd9be7a
Created June 8, 2015 15:56
Remove Login from Theme My Login Login
// Change the Theme My Login Login Template Header
function tml_title_filter( $title, $action ) {
if ( 'login' == $action ) return '';
return $title;
}
add_filter( 'tml_title', 'tml_title_filter', 10, 2 );
@nathaningram
nathaningram / gist:41b45ace1959bb9b9683
Created August 10, 2015 14:08
Remove Visual Composer Nag
// Remove Visual Composer Nag
add_action('admin_init', function()
{
setcookie('vchideactivationmsg', '1', strtotime('+3 years'), '/');
});
@nathaningram
nathaningram / gist:53b60b1286c3948669a1
Created August 10, 2015 14:12
Remove Visual Compose Meta Data
//Remove Visual Composer Meta Data
add_action('init', 'myoverride', 100);
function myoverride() {
remove_action('wp_head', array(visual_composer(), 'addMetaData'));
}
@nathaningram
nathaningram / gist:fd0b4c8cf3f79f32baf0
Last active January 13, 2016 20:48
Builder Full Width - HTML Module - Video Background
[rev_slider alias="Home2"]
<div id="header-container-wrapper">
<div id="header-container">
<div id="header-logo"><a href="http://wpnathan.com"><img src="http://wpnathan.com/wp-content/media/lone-palm-logo.png"></a></div>
<div id="header-menu"><?php wp_nav_menu( array('menu' => 'Palm Menu' )); ?></div>
@nathaningram
nathaningram / gist:d9c99f078d321f4f8cdd
Last active January 13, 2016 20:48
Builder Full Width - CSS
/*********************************************
Full Width Awesomeness Webinar
*********************************************/
/* Header Logo and Navigation */
#header-container-wrapper {
position: absolute;
top: 0;
width: 100%;