Skip to content

Instantly share code, notes, and snippets.

@mjn666
Last active January 3, 2016 20:29
Show Gist options
  • Save mjn666/8515293 to your computer and use it in GitHub Desktop.
Save mjn666/8515293 to your computer and use it in GitHub Desktop.
What it says on the tin
/**
* Embed HealCode
* {@link https://www.healcode.com}
* Usage: [healcode id="_ID_" name="_NAME_"]
*/
if ( ! function_exists(healcode_shortcode) ) {
function healcode_shortcode($atts, $content = null) {
extract(shortcode_atts(array(
'id' => '',
'name' => ''
), $atts ));
ob_start(); ?>
<div class="healcode">
<script type="text/javascript">
healcode_widget_id = '<?php echo $id ?>';
healcode_widget_name = '<?php echo $name ?>';
healcode_widget_type = "mb";
document.write(unescape("%3Cscript src='https://www.healcode.com/javascripts/hc_widget.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<noscript>Please enable Javascript in order to get <a href="https://www.healcode.com" target="_blank">HealCode</a> functionality</noscript>
</div>
<?php
$html = ob_get_clean();
return $html;
}
}
add_shortcode('healcode', 'healcode_shortcode');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment