This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
input:-webkit-autofill, | |
textarea:-webkit-autofill, | |
select:-webkit-autofill { | |
-webkit-box-shadow: 0 0 0 1000px white inset; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function() { | |
// Check for all images to be loaded | |
$.fn.imagesLoaded = function() { | |
var dfds = []; | |
var $imgs = this.find('img[src!=""]'); | |
$imgs.each(function() { | |
var dfd = $.Deferred(); | |
dfds.push(dfd); | |
var img = new Image(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* For Themes */ | |
wp_enqueue_style('slug', get_template_directory_uri().'/css/slug.css', array(), filemtime(get_template_directory().'/css/slug.css')); | |
wp_enqueue_script('slug', get_template_directory_uri().'/js/slug.js', array(), filemtime(get_template_directory().'/js/slug.js')); | |
/* For Plugins */ | |
wp_enqueue_style('slug', plugin_dir_url(__FILE__).'css/slug.css', array(), filemtime(plugin_dir_path(__FILE__).'css/slug.css')); | |
wp_enqueue_script('slug', plugin_dir_url(__FILE__).'js/slug.js', array(), filemtime(plugin_dir_path(__FILE__).'js/slug.js')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function saveFile(url) { | |
var filename = url.substring(url.lastIndexOf("/") + 1).split("?")[0]; | |
var xhr = new XMLHttpRequest(); | |
xhr.responseType = 'blob'; | |
xhr.onload = function() { | |
var a = document.createElement('a'); | |
a.href = window.URL.createObjectURL(xhr.response); | |
a.download = filename; | |
a.style.display = 'none'; | |
document.body.appendChild(a); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add a blank option to a Gravity Forms dropdown | |
* | |
* @param object $form The Gravity Form | |
* @return object $form The modified Gravity Form | |
*/ | |
function wp_gravity_forms_add_empty_dropdown_option( $form ) { | |
// Select the correct form, then set the id of the field(s) we need to change | |
if( $form['id'] == 1 ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* ACF Load Field Choices. | |
* | |
* @param array $field The field that we are going to add options to | |
* @return array $field The field we modified | |
*/ | |
function acf_load_field_choices( $field ) { | |
// Reset choices | |
$field['choices'] = array(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Create a custom length excerpt. | |
* | |
* @param integer $limit How many words you want returned | |
* @return string $content The content string | |
*/ | |
function wp_excerpt_length( $limit=50 ) { | |
$content = get_the_content(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Create an array of an attachment image's data. | |
* | |
* @param int $id The id of the attachment image | |
* @return array $image An array of all the image data | |
*/ | |
function wp_get_attachment_image_data( $id=null ) { | |
$image = array(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Create an associative array from a csv file. | |
* | |
* @param file $file The csv file that is going to be parsed | |
* @return array $data An associative array with the csv headings as keys | |
*/ | |
function csv_to_array( $file ) { | |
$data = array(); | |
$header = null; |