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_action( 'add_meta_boxes', 'custom_meta_boxes' ); | |
add_action( 'save_post', 'ExtraImageProperty_save' ); | |
function custom_meta_boxes() { | |
add_meta_box('ExtraImageProperty', 'Extra Image Property', 'ExtraImageProperty', 'page'); | |
} | |
function ExtraImageProperty() { | |
global $post; | |
$extra_image_url = get_post_meta($post->ID, 'extra_image_url', true); |
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 get_attachment_id_from_src ($src) { | |
global $wpdb; | |
$reg = "/-[0-9]+x[0-9]+?.(jpg|jpeg|png|gif)$/i"; | |
$src1 = preg_replace($reg,'',$src); | |
if($src1 != $src){ | |
$ext = pathinfo($src, PATHINFO_EXTENSION); | |
$src = $src1 . '.' .$ext; | |
} | |
$query = "SELECT ID FROM {$wpdb->posts} WHERE guid='$src'"; | |
$id = $wpdb->get_var($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
tar -c --bzip2 -f foo.tar.bz1 foo/ |
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
$myValue = '123'; | |
// First you need to set the visual value, then you need to set it selected, this is retarted | |
$('#myselect').val($myValue).attr("selected", "selected"); |
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
sed 's/old/new/g' input.txt > output.txt |
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
split -d -b 4300m backup.tar.bz2 backup.tar.bz2. | |
cat backup.tar.bz2.* > backup.tar.bz2 |
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
git tag -a v0.2.1 12edf74 -m "First internal release" | |
git push origin v0.2.1 |
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
/<\s*\/?\s*[p,span]\s*.*?>/g |
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_filter( 'post_thumbnail_html', 'remove_thumbnail_dimensions', 10 ); | |
add_filter( 'image_send_to_editor', 'remove_thumbnail_dimensions', 10 ); | |
add_filter( 'the_content', 'remove_thumbnail_dimensions', 10 ); | |
function remove_thumbnail_dimensions( $html ) { | |
$html = preg_replace( '/(width|height)=\"\d*\"\s/', "", $html ); | |
return $html; | |
} | |
?> |
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
// there is a solution for jQuery < 1.9.0, where you can use `$.browser`: | |
// https://gist.github.com/nathansmith/950767 | |
// but jQuery removed `$.browser` in version 1.9.0, so you have to get another way: | |
function last_child() { | |
if (/msie [1-8]{1}[^0-9]/.test(navigator.userAgent.toLowerCase())) { | |
$('*:last-child').addClass('last-child'); | |
} | |
} |
OlderNewer