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
#!/usr/bin/env bash | |
function optimize | |
{ | |
echo $1 | |
filesize=`stat -f %z "$1"` | |
if [[ $filesize -lt 10000 ]]; then | |
jpegtran -copy none -optimize "$1" > "$1.bak" | |
echo "pet | |
else |
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
// Add Categories To WordPress Attachments | |
add_action( 'init' , 'add_categories_for_attachments' ); | |
function add_categories_for_attachments(){ | |
register_taxonomy_for_object_type( 'category', 'attachment' ); | |
} | |
// Add Tags To WordPress Attachments | |
add_action( 'init' , 'add_tags_for_attachments' ); | |
function add_tags_for_attachments() { | |
register_taxonomy_for_object_type( 'post_tag', 'attachment' ); |
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
// DEBUG HTTP REQUESTS W/ LOG | |
function wp_log_http_requests( $response, $args, $url ) { | |
// set your log file location here | |
$logfile = plugin_dir_path( __FILE__ ) . '/http_requests.log'; | |
// parse request and response body to a hash for human readable log output | |
$log_response = $response; | |
if ( isset( $args['body'] ) ) { | |
parse_str( $args['body'], $args['body_parsed'] ); | |
} |
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
// Override and customize Isotope FitRows layout mode: CENTER each rows | |
var fitRows = Isotope.LayoutMode.modes.fitRows.prototype; | |
fitRows._resetLayout = function() { | |
// pre-calculate offsets for centering each row | |
this.x = 0; | |
this.y = 0; | |
this.maxY = 0; | |
this._getMeasurement( 'gutter', 'outerWidth' ); | |
this.centerX = []; |
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
jQuery('img').each(function(){imgsrc = this.src); console.log(imgsrc);}) |
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
zip -r [filename.zip] [foldername] -x "*.DS_Store" -x *.git* |
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
<script> | |
// Fix for themeforest preview frame | |
if( self != top ) { | |
headTag = document.getElementsByTagName("head")[0].innerHTML; | |
var frameCSS = headTag + '<style type="text/css">@media screen and (max-width:600px){.carousel-item-transparent{max-height:420px;}}</style>'; | |
document.getElementsByTagName('head')[0].innerHTML = frameCSS; | |
} | |
</script> |