• Resolved mfritch

    (@mfritch)


    First of all, thank you for the plugin and the fast turnaround on the latest version!

    It appears that the shortcode is not resetting the postdata when it is done. I have the Google Calendar inserted on a page by the shortcode:

    [google-calendar-events id="1" type="ajax" title="Events on" interval="event" interval_count="100"]

    With the newest version installed, I noticed my sidebars weren’t behaving properly. The post id of the page that the shortcode is on is 56, but afterwards the $post-ID is 2008 which is the post id of the GCal Event Feed ID 1.

    I put in the following workaround:

    <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
        <?php $post_id = $post->ID; ?>
        <div id="cont-pri">
            <h1 class="entry-title"><?php the_title(); ?></h1>
    
            <?php the_content(); ?>
    
            <!-- Fix for bug in Google Events Calendar Plugin -->
            <?php if ( $post_id != $post->ID ) {wp_reset_postdata(); } ?>
    
        </div><!-- #cont-pri -->
    
    <?php endwhile; ?>

    https://ww.wp.xz.cn/plugins/google-calendar-events/

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Shortcode not resetting postdata in 2.1.0’ is closed to new replies.