- find me on twitter, codepen
- heckle me on Twitter, use the hashtag
- a little bit about myself
- worked on the web for over a decade now
- just left a gig at TheZebra.com
- a team of about 2 dozen
- was there about 2 years
- lone designer, lots of engineers
- made me think about our process
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
//start by checking for a couple of key pieces of info | |
$current_user = wp_get_current_user(); | |
$private_comments = get_post_meta($post->ID, 'private_comments', true); | |
$meta_lock = get_post_meta($post->ID, 'meta_lock', true); | |
$time_lock = get_post_meta($post->ID, 'time_lock', true); | |
//if the post has the custom field 'meta_lock' | |
if ($meta_lock) { | |
//check the current user for that meta field | |
$user_meta_key = get_user_meta($current_user->ID, $meta_lock, 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
<?php | |
$deal_price = get_post_meta($post->ID, 'deal_price', true); | |
$old_price = get_post_meta($post->ID, 'old_price', true); | |
$discount = round(((1-($deal_price / $old_price))*100),0); | |
echo $discount.'%'; ?> |
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 | |
//let's get my klout score!! | |
//first, let's see if I've got the data already cached locally | |
$klout = get_transient("klout"); | |
//dang it! it looks like I might not. let's check with the Klout API | |
if( !$klout ) { | |
$json = file_get_contents("http://api.klout.com/1/klout.json?key=[API key]&users=clarklab"); |
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 update_user_points($id, $value){ | |
$points = get_user_meta($id, 'points', true); | |
$points = $points + $value; | |
update_user_meta($id, 'points', $points); | |
return $points; | |
} |
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 | |
/* | |
Template Name: Redirect | |
*/ | |
$redirect_url = get_post_meta($post->ID, 'redirect_url', true); | |
// get the destination URL | |
$count = get_post_meta($post->ID, 'count', true); | |
// get the number of times it's been clicked |
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 | |
//start a new WP_Query with whatever parameters you want | |
$firstquery = new WP_Query(array( | |
'posts_per_page' => 2 | |
'tag' => 'summer' | |
)); | |
//start some looping action on $firstquery | |
while ($firstquery->have_posts()) : $firstquery->the_post(); |
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
<snippet> | |
<content><![CDATA[ | |
\$${1:query} = new WP_Query('posts_per_page=5'); | |
while (\$${1:query}->have_posts()) : \$${1:query}->the_post(); | |
${0:// do something} | |
endwhile; | |
]]></content> | |
<tabTrigger>wpq</tabTrigger> | |
<scope>source.php</scope> | |
<description>WP_Query basic loop</description> |
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
<!-- in footer.php --> | |
<div class="footer-text"><?php echo get_theme_mod('footer_text') ?></div> | |
<!-- rendered HTML content --> | |
<div class="footer-text">©2012 Site Name</div> | |
<!--in functions.php (to enable the field in the Theme Customizer) --> | |
<?php |
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 post_format_picker () { | |
$screen = get_current_screen(); | |
if ( $screen->id == 'post' ) { | |
echo '<script>jQuery(document).ready(function(){ | |
var hash = window.location.hash; | |
if (hash){ | |
jQuery("a[href$="+hash+"]").click(); |
OlderNewer