Support » Plugin: Easy Image Gallery » First gallery shows twice when embedding shortcode

  • I am embedding Easy Image Galleries using their shortcode into the Easy Accordion plugin. This is working as expected. However, the first gallery on a page with multiple galleries renders twice; once inside the accordion (as expected), and once again below the accordion. The page content is *only* the shortcode for the accordion. Somehow the gallery gets rendered twice.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter watashifr

    (@watashifr)

    I believe the problem is with the following code:

    function easy_image_gallery_append_to_content( $content ) {
    	// if it is single page and supported post_type and page not have shortcode.
    	if ( is_singular() && is_main_query() && easy_image_gallery_allowed_post_type() && !easy_image_gallery_has_shortcode('easy_image_gallery') && ! easy_image_gallery_has_block('wp-block-devrix-easy-image-gallery-block') ) {
    		$new_content = easy_image_gallery( 'old_db' );
    		$content .= $new_content;
    	}
    

    I think the !easy_image_gallery_has_shortcode function fails because the content of the accordion is rendered after this check occurs.

    Thread Starter watashifr

    (@watashifr)

    If I skip the easy_image_gallery_append_to_content function, the page works as intended (i.e. showing galleries in the accordion but not outside).

    Hi there,
    I see you found a solution does this work for you as you wish?
    We are expecting a new version of the plugin soon

    Kind regards,
    Plamen

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘First gallery shows twice when embedding shortcode’ is closed to new replies.