Skip to content

Instantly share code, notes, and snippets.

<div class="google-ad">
<span class="sponsored"><a href="">Sponsored Links</a></span>
<p>
<a class="ad-title" href="">Mitt Romney Official Site</a><br>
<span class="ad-desc">Support a Smaller, Smarter, Simpler Government? Donate $5 Now!</span><br>
<a class="ad-url" href="">www.Victory.MittRomney.com</a>
</p>
@micahwave
micahwave / gist:2990072
Created June 25, 2012 17:38
fb subscribe
<div class="subscribe">
<div class="fb-subscribe" data-href="<?php echo esc_url( $fb ); ?>" data-layout="button_count" data-show-faces="false" data-width="75"></div>
Subscribe to <?php the_author(); ?> on Facebook
</div>
@micahwave
micahwave / gist:3035095
Created July 2, 2012 19:20
rewrite rules
// make it so we can use /photo/x/ with galleries
function time_rewrite_rules() {
global $wp_rewrite;
add_rewrite_tag( '%photo%', '([^&]+)' );
add_rewrite_tag( '%slide%', '([^&]+)' );
add_rewrite_tag( '%tab%', '([^&]+)' );
add_rewrite_endpoint('photo', EP_PERMALINK);
add_rewrite_endpoint('video', EP_PERMALINK);
add_rewrite_endpoint('slide', EP_PERMALINK);
@micahwave
micahwave / gist:3078566
Created July 9, 2012 20:02
Some landing markup
<section class="triple">
<h2 class="section-title">Latest and Greatest2</h2>
<div class="row"> <div class="tout">
<a href="http://micahland.com/tout/bat-pod/"><figure class="entry-thumb entry-thumb-m "><img src="http://micahland.com/wp-content/uploads/2012/06/Bat-pod-767743-460x307.jpg" class="full-width wp-post-image" alt="Bat-pod-767743" title="Bat-pod-767743" /></figure></a> <h3> <a href="http://micahland.com/tout/bat-pod/" title="Permalink to Bat&nbsp;Pod" rel="bookmark">Bat&nbsp;Pod</a>
</h3>
<div class="entry-content"><p>It has been eight years since Batman vanished into the night, turning, in that instant, from hero to fugitive. </p>
</div>
</div>
<div class="tout">
<a href="http://micahland.com/tout/the-bat/"><figure class="entry-thumb entry-thumb-m "><img src="http://micahland.com/wp-content/uploads/2012/06/tdkrbtwngpic-460x307.jpg" class="full-width wp-post-image" alt="tdkrbtwngpic" title="tdkrbtwngpic" /></figure></a> <h3> <a href="
@micahwave
micahwave / gist:3085585
Created July 10, 2012 19:12
iframe ad
<html>
<head>
<title>adFactory</title>
<script type="text/javascript" src="http://img.timeinc.net/shared/static/js/tii_ads.js"></script>
</head>
<style type="text/css">
body * {
margin: auto;
}
</style>
@micahwave
micahwave / gist:3085636
Created July 10, 2012 19:19
ad resize parent frame
// resize the sidebar iframe when a new ad gets loaded
function time_resize_iframe(id, w, h) {
if( jQuery(id).length ) {
jQuery(id).attr('width', w).attr('height', h);
}
}
<html>
<head>
<title>BP</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
</head>
<body>
<script type="text/javascript">
function render_tweet_text( data ) {
if( typeof data.tweets != undefined ) {
document.write( data.tweets[0].text );
function render_tweet_text( data ) {
if( typeof data.tweets != undefined ) {
jQuery('#sponsor_content').html( format_links( data.tweets[0].text ) );
}
}
function format_links( str ) {
str = ' '+str;
str = str.replace(/((ftp|https?):\/\/([-\w\.]+)+(:\d+)?(\/([\w/_\.]*(\?\S+)?)?)?)/gm,'<a href="$1" target="_blank">$1</a>');
@micahwave
micahwave / gist:3172454
Created July 24, 2012 20:33
responsive img
time_the_post_thumbnail( 'l', array(
'breakpoints' => array(
'0' => 'm 1x, l 2x',
'476' => 'l 1x, xxl 2x',
'951' => 'xl 1x, xxl 2x',
)
));
@micahwave
micahwave / gist:3183795
Created July 26, 2012 18:53
Group by order by
"
SELECT g.*, p.ID as article_id, p.post_title as article_title
FROM $wpdb->posts AS g
LEFT JOIN $wpdb->postmeta AS pm ON pm.meta_value = g.ID
LEFT JOIN $wpdb->posts AS p ON pm.post_id = p.ID
LEFT JOIN $wpdb->postmeta AS pm2 ON pm2.post_id = g.ID
WHERE g.post_type = 'time_guest'
AND pm.meta_key = 'time_guest_author'
AND pm2.meta_key = 'time_guest_time100'
AND ( pm2.meta_value = 'on' OR pm2.meta_value = 1 )