Skip to content

Instantly share code, notes, and snippets.

@georgestephanis
Created September 24, 2014 21:41
Show Gist options
  • Save georgestephanis/0028bbcab1971e0008ed to your computer and use it in GitHub Desktop.
Save georgestephanis/0028bbcab1971e0008ed to your computer and use it in GitHub Desktop.
<?php
wp_oembed_add_provider( 'http://*.houzz.com/*', 'http://www.houzz.com/oembed' );
function do_houzz_shortcode($atts, $content=null) {
$url = substr( $atts[0], 1 );
$args = array();
if ( isset( $atts['w'] ) && is_numeric( $atts['w'] ) ) {
$args['width'] = $atts['w'];
}
if ( isset( $atts['h'] ) && is_numeric( $atts['h'] ) ) {
$args['height'] = $atts['h'];
}
$oembed = _wp_oembed_get_object();
return $oembed->get_html( $url, $args );
}
add_shortcode('houzz', 'do_houzz_shortcode');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment