Skip to content

Instantly share code, notes, and snippets.

View pdewouters's full-sized avatar
🌄
Working from home

Paul de Wouters pdewouters

🌄
Working from home
View GitHub Profile
@pdewouters
pdewouters / gist:1680885
Created January 26, 2012 03:56
display plugin download count from wordpress.org repository
function wpc_get_plugin_dl_count(){
$payload = array(
'action' => 'plugin_information',
'request' => serialize(
(object)array(
'slug' => 'pinterest-rss-widget',
'fields' => array('description' => true)
)
)
);
@pdewouters
pdewouters / load_print_styles
Created February 1, 2012 14:41
Genesis add print styles
add_action('wp_enqueue_scripts','ago_load_print_styles');
function ago_load_print_styles(){
wp_enqueue_style('print-styles', get_stylesheet_directory_uri() . '/print.css',false,false,'print');
}
@pdewouters
pdewouters / html5-elements.html
Created February 9, 2012 22:40
an html5 document with all elements for testing styles
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>HTML5 elements test</title>
</head>
<body>
<header>
@pdewouters
pdewouters / gist:1885106
Created February 22, 2012 13:11
fetch photos on flickr by tag
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<title>Flickr</title>
<style>
body { width: 600px; margin: auto; }
ul { list-style: none; }
li { padding-bottom: 1em; }
img { float: left; padding-right: 1em; }
if( wife.outoftown === true){
setReminder(plantsNeedWatering, d + 2);
}
@pdewouters
pdewouters / gist:2050206
Created March 16, 2012 14:08
enqueue google fonts
add_action('wp_enqueue_scripts', 'child_load_scripts_styles');
// Load necessary scripts and styles
function child_load_scripts_styles(){
if( is_admin() )
return;
// google fonts
wp_enqueue_style( 'opensans-gf', 'http://fonts.googleapis.com/css?family=Open+Sans', false, false, 'screen' );
wp_enqueue_style( 'lemon-gf', 'http://fonts.googleapis.com/css?family=Lemon', false, false, 'screen' );
@pdewouters
pdewouters / gist:2053258
Created March 16, 2012 22:23
ECPT image loop
$images = get_post_meta($post->ID, 'ecpt_repeatable', true);
if($images) {
foreach($images as $image) {
echo '<div class="image"><img src="' . $image . '"/></div>';
}
}
@pdewouters
pdewouters / gist:2150133
Created March 21, 2012 17:46
Registers a pricing_table shortcode
add_filter( 'the_content', 'shortcode_unautop' );
// Register a new shortcode: [pricing_table]
add_shortcode( 'pricing_table', 'cuj_pricing_table' );
add_shortcode('pricing_item', 'cuj_pricing_item');
// The callback function that will replace [pricing_table]
function cuj_pricing_table($attr,$content) {
$pricing_table = '<div class="pricing_table"><h4>' . $attr['title']. '</h4>' . do_shortcode($content) . '</div>';
@pdewouters
pdewouters / gist:2170433
Created March 23, 2012 12:55
add class to images for the drop shadow effect
jQuery(document).ready(function($){
$('.entry-content img, .wp-caption img').wrap('<div class="drop-shadow" />');
$('.entry-content img').each(function(){
var thisWidth = $(this).width();
var thisClasses = $(this).attr('class');
$(this).removeClass(thisClasses).parent('.drop-shadow').css('width',thisWidth).addClass(thisClasses);
@pdewouters
pdewouters / gist:2172989
Created March 23, 2012 17:23
Contact form 7 with colorbox and spots
echo '<div id="home-banner"><div class="inner">';
if ( function_exists( 'icit_spot' ) )
$spot = icit_get_spot( 'home banner', false );
echo do_shortcode($spot);
echo '</div></div>';
//jQuery
$(".inline").colorbox({inline:true, href:"#contact_form"});