- Toss all
.sublime-snippet
files into/Packages/User/
in your sublime install - Optional
- Copy the lines from
sample.sublime-keymap
into your user keymap More Info Here
- Copy the lines from
This file contains 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 | |
/** | |
* Retrieve the adjacent posts for a specific custom post type and taxonomy. | |
* | |
* This function returns the previous and next posts based on the provided | |
* custom post type, taxonomy, and ordering by published date in descending order (newest first). | |
* | |
* @param int $post_id The ID of the current post. | |
* @param string $taxonomy The taxonomy to filter posts by. | |
* @param string $post_type The custom post type to query. |
This file contains 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
// paste into WP console in admin | |
jQuery(document).ready(function($) { | |
$('.acf-flexible-content .values .acf-icon.-collapse').click(function(e){ | |
$this = $(this); | |
if(e.shiftKey) { | |
open = $this.is('.-collapsed .-collapse'); | |
console.log('shift clicked'); | |
console.log('open: ', open); | |
if (open){ | |
$all = $this.parentsUntil('.values').parent().find('.-collapsed .acf-icon.-collapse'); |
This file contains 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 | |
function getBootstrapBreakpoints() { | |
return array( | |
'xs', | |
'sm', | |
'md', | |
'lg', | |
'xl', | |
); |
This file contains 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 | |
// knock out default filter | |
remove_filter('the_content','wpautop'); | |
// add NEW filter | |
add_filter('the_content','post_custom_formatting'); | |
function post_custom_formatting($content){ | |
global $post; | |
// to remove the wpautop add a meta field to the post called 'wpautop' equal to 'false' | |
$nope = trim(get_post_meta( $post->ID, 'wpautop', true )) === 'false'; | |
if($nope){ |
This file contains 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 | |
function cascade_values(){ | |
for ($i = 0; $i < func_num_args(); $i++) { | |
$val = func_get_arg($i); | |
if(!empty($val)){ | |
return $val; | |
} | |
} | |
return false; | |
} |
This file contains 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
curl "http://loripsum.net/api/5/medium/decorate/link/ul/ol/dl/bq/code/headers/" | sed "s/<\/p>/<\/p>\<\!\-\-more\-\-\>/" | wp post generate --post_content --count=1 --post_author=$(wp user list --role=administrator --field=ID --format=json | sed "s/\[//" | sed "s/\]//" | sed "s/\,.*//") |
This file contains 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 this to your plugin file or to functions.php | |
function my_add_oembed_providers() { | |
wp_oembed_add_provider( '#http://(www\.)?ustream.tv/*#i', 'http://www.ustream.tv/oembed', true ); | |
} | |
add_action( 'init', 'my_add_oembed_providers' ); | |
?> |
This file contains 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 add_theme_features() { | |
// Add Image Sizes | |
$containerLG = 1170; // Change this if you have updated the largest bootstrap container width. | |
for ($i=1; $i <= 12; $i++) { | |
add_image_size( | |
'col-lg-'.$i, | |
ceil($containerLG / 12 * $i), | |
ceil($containerLG / 12 * $i) * 10, | |
false | |
); |
This file contains 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
#!/bin/bash | |
for ((i=1;i<=$#;i++)); | |
do | |
if [ ${!i} = "--dbname" ] | |
then ((i++)) | |
dbname=${!i}; | |
elif [ ${!i} = "--dbuser" ]; | |
then ((i++)) |
NewerOlder