Skip to content

Instantly share code, notes, and snippets.

@bhubbard
Forked from georgestephanis/houzz.php
Created December 1, 2015 20:08
Show Gist options
  • Save bhubbard/c7aaede67eb3dea480b3 to your computer and use it in GitHub Desktop.
Save bhubbard/c7aaede67eb3dea480b3 to your computer and use it in GitHub Desktop.
<a class="houzz-share-button"
data-url="http://www.yoursite.com/product/page/ "
data-hzid="Your HZID"
data-title="Product Title as it will be seen inside Houzz "
data-img="http://yoursite/path/to/product/image.jpg "
data-desc="Product description text "
data-category="Category keywords "
data-showcount="1 "
href="https://www.houzz.com">Houzz</a>
<script>(function(d,s,id){if(!d.getElementById(id)){var js=d.createElement(s);js.id=id;js.async=true;js.src="//platform.houzz.com/js/widgets.js?"+(new Date().getTime());var ss=d.getElementsByTagName(s)[0];ss.parentNode.insertBefore(js,ss);}})(document,"script","houzzwidget-js");</script>
<?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