This extends the built-in WordPress function get_the_ID()
to return the post ID both inside and outside the loop.
<?php if ( function_exists( 'gt_hide_nav' ) && ! gt_hide_nav() ) : ?>
<nav role="navigation">
<?php if ( function_exists( 'bones_main_nav' ) ) bones_main_nav(); ?>
</nav>
<?php endif; // hide nav ?>
<?php
function gt_wistia_enqueue() {
if ( has_shortcode( 'wistia' ) ) {
wp_enqueue_script( 'wistia-embed-shepherd', '//fast.wistia.com/static/embed_shepherd-v1.js', array(), 'v1', false );
}
}
add_filter( 'the_post', 'gt_wistia_enqueue' );