Skip to content

Instantly share code, notes, and snippets.

Hung PD thehung2224

View GitHub Profile
@thehung2224
thehung2224 / Share Pinterest
Created May 25, 2017 — forked from cdharrison/pinterest
Set Default Pinterest Share Image based on Featured Image
View Share Pinterest
<?php if ( has_post_thumbnail() ) :
$src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), array( 720,405 ), false, '' );
?>
<a href="http://pinterest.com/pin/create/button/?media=<?php echo $src[0]; ?>&url=<?php the_permalink() ?>" class="pin-it-button" count-layout="none"><img border="0" src="//assets.pinterest.com/images/PinExt.png" title="Pin It" /></a>
<?php else : ?>
<a href="http://pinterest.com/pin/create/button/?media=http://example.com/example.png&url=<?php the_permalink() ?>" class="pin-it-button" count-layout="none"><img border="0" src="//assets.pinterest.com/images/PinExt.png" title="Pin It" /></a>
<?php endif; ?>
@thehung2224
thehung2224 / gist:c50e695b458d64104f62
Last active Aug 29, 2015
Cách dùng Preg_match trong PHP
View gist:c50e695b458d64104f62
if ( !function_exists( 'extract_gallery_images_ids' ) ) {
function extract_gallery_images_ids() {
global $post;
$content = "[gallery ids="7,8,9,10"]";
$pattern = "\[(\[?)(embed|wp_caption|caption|playlist|audio|video|dot_recommends|dot_recommended_posts|gallery)(?![\w-])([^\]\/]*(?:\/(?!\])[^\]\/]*)*?)(?:(\/)\]|\](?:([^\[]*+(?:\[(?!\/\2\])[^\[]*+)*+)\[\/\2\])?)(\]?)"
preg_match( "/$pattern/s", $content, $match );
View gist:8430660
.round(@radius: 5px){
-webkit-border-radius: @radius;
-moz-border-radius: @radius;
border-radius: @radius;
-webkit-background-clip: padding-box;
-moz-background-clip: padding;
background-clip: padding-box;
}
View gist:8429919
/**
* Eric Meyer's Reset CSS v2.0 (http://meyerweb.com/eric/tools/css/reset/)
* http://cssreset.com
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
@thehung2224
thehung2224 / gist:8423555
Created Jan 14, 2014
Lorem: Very short text
View gist:8423555
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
@thehung2224
thehung2224 / gist:8414537
Created Jan 14, 2014
HTML: Standard Template
View gist:8414537
<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8"> <![endif]-->
<!--[if !IE]><!--> <html lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<title> </title>
<meta name="description" content="">
<meta name="author" content="">
You can’t perform that action at this time.