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 | |
/** | |
* Retrive ID from attachment URL | |
* Source http://philipnewcomer.net/2012/11/get-the-attachment-id-from-an-image-url-in-wordpress/ | |
*/ | |
function get_id_from_attachment_url($attachment_url = '') { | |
global $wpdb; |
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
# Create git repository | |
git init | |
# Add all files to staging area | |
git add . | |
# Check current status | |
git status | |
# Commit staged changes for tracking |
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 | |
/** | |
* WordPress Custom Post Type & Taxonomy rewrite notes: | |
* When creating CPT/Tax always rewrite the slug and make sure 'with_front' is set to false | |
* In the rewrite section add following | |
*/ | |
$args = array( | |
'rewrite' => array( | |
'slug' => 'SLUG', # Used as pretty permalink text (i.e. /tag/) - defaults to $taxonomy (taxonomy's name slug) |
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 | |
/** | |
* -------------------------------------------------- | |
* Gravity Form dynamically populate drop-down | |
* select for Questions form ID 15 | |
* 'gform_pre_render_14' - _14 represents form ID to filter | |
* -------------------------------------------------- | |
*/ | |
add_filter( 'gform_pre_render_14', 'pre_populate_gravity_select_for_MY_TAX' ); | |
add_filter( 'gform_pre_validation_14', 'pre_populate_gravity_select_for_MY_TAX' ); |
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
# Let's Encrypt | |
# Install Process | |
cd ~ | |
git clone https://github.com/letsencrypt/letsencrypt | |
cd letsencrypt | |
sudo ./letsencrypt-auto certonly --standalone --agree-tos --redirect --duplicate --text --email [email protected] -d EXAMPLE.COM -d WWW.EXAMPLE.COM | |
# Nginx Configuration | |
# https://github.com/h5bp/server-configs-nginx/blob/master/h5bp/directive-only/ssl.conf | |
# Path to Certificates | |
# /etc/letsencrypt/live/EXAMPLE.COM/privkey.pem |
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 convert( num ) { | |
var x = ''; | |
[1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1].map( | |
function( obj, i ) { | |
while ( num >= obj ) { | |
x += ['M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I'][i]; | |
num -= obj; | |
} | |
} | |
); |
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
<snippet> | |
<content> | |
<![CDATA[ | |
/** @test */ | |
function ${1/\s/_/g}() | |
{ | |
${0:// ${1:type method name with spaces when done press tab}} | |
} | |
]]> | |
</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 | |
/** | |
* Disable Default Gallery | |
*/ | |
remove_shortcode('gallery', 'gallery_shortcode'); | |
/** | |
* Custom Gallery | |
*/ | |
add_shortcode( 'gallery', 'custom_gallery_shortcode' ); | |
function custom_gallery_shortcode( $attributes ) { |