Skip to content

Instantly share code, notes, and snippets.

@jasonyingling
jasonyingling / gist:191b19368e6f069f6263
Created February 12, 2015 19:43
ddSlick for Gravity Forms Drop Downs
$('.gfield select').each(function(e) {
var selectID = $(this).attr('id');
var selectName = $(this).attr('name');
$('#'+selectID).ddslick({
width: '100%',
background: '#ffffff',
onSelected: function(data){
$('#'+selectID+' .dd-selected-value').attr('name', selectName);
}
});
@jasonyingling
jasonyingling / functions.php
Last active November 24, 2015 15:57
Registering a Sidebar in WordPress
// Function to create widgetized area
function meetup_widgetized_area() {
$args = array(
'name' => __('Meetup Widgetized Area', 'sample-child'),
'id' => 'meetup-widgetized-area',
'description' => 'A sample widegetized area',
'class' => '',
'before_widget' => '<section id="%1$s" class="widget %2$s">',
'after_widget' => '</section>',
'before_title' => '<h2 class="widgettitle">',
@jasonyingling
jasonyingling / functions.php
Created November 24, 2015 15:58
Creating a Custom Widget in WordPress
// Creating a Custom widget
/**
* Adds Foo_Widget widget.
*/
class Foo_Widget extends WP_Widget {
/**
* Register widget with WordPress.
*/
function __construct() {
@jasonyingling
jasonyingling / .bash_profile
Last active December 20, 2015 12:08
.bash_profile to display directory location and current git branch. Based off Ollo's .bash_profile here https://gist.github.com/Ollo
Prompt and prompt colors
# 30m - Black
# 31m - Red
# 32m - Green
# 33m - Yellow
# 34m - Blue
# 35m - Purple
# 36m - Cyan
# 37m - White
# 0 - Normal
@jasonyingling
jasonyingling / 4d3d3d3
Created August 2, 2013 22:22
Quickly and easily up your 4d3d3d3 by adding this to you .bash_profile
alias 4d3d3d3="/usr/bin/open -a '/Applications/Google Chrome.app' 'http://www.youtube.com/watch?v=XWX4GUYGQXQ'"
<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>
$users = get_users( array( 'role' => 'author' ) );
foreach ( $users as $user ) {
the_field( 'field_name', 'user_' . $user->ID );
}
@jasonyingling
jasonyingling / functions.php
Created May 24, 2018 01:59
Remove Reading Time from all but single posts in Reading Time WP
<?php
function reading_time_remove_front_page() {
if ( ! is_singular() ) {
global $readingTimeWP;
remove_filter('the_content', array($readingTimeWP, 'rt_add_reading_time_before_content'));
}
}
add_action( 'wp', 'reading_time_remove_front_page' );
@jasonyingling
jasonyingling / gist:466f214819899e0f7087de29b2927d70
Last active June 8, 2018 16:18
DDSlick with Gravity Forms
$('.gfield select').each(function(e) {
// Hide the select element
$(this).css('display', 'none');
// clone the select element
clone = $(this).clone();
// append the cloned select after the first select
$(this).after(clone);
// store the original select ID
var selectID = $(this).attr('id');
// Call ddslick on the cloned select
<a class="fancybox-form" href="#contact-jess">Email Jess</a>
<div id="contact-jess" style="display: none;">[gravityform id="5" title="true" description="true" ajax="true"]</div>