Instantly share code, notes, and snippets.

What would you like to do?
Google Calendar Events: How to properly enqueue scripts and styles in a page template when using do_shortcode().
Template Name: Stripe Checkout PRO page template
// Enqueue Google Calendar Events CSS.
wp_enqueue_style( 'google-calendar-events-public' );
// Enqueue Google Calendar Events JS.
wp_enqueue_script( 'google-calendar-events-public' );
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
// Start the loop.
while ( have_posts() ) : the_post();
// Include the page content template.
get_template_part( 'content', 'page' );
// End the loop.
<?php echo do_shortcode( '[gcal id="123"]' ); ?>
</main><!-- .site-main -->
</div><!-- .content-area -->
<?php get_footer(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment