td_wp_booster_functions – Filter name and output buffer

Posted in: Newspaper
Post count: 7

In includes\wp_booster\td_wp_booster_functions.php there is a function for generating the galleries. It is called “my_gallery_shortcode”. Clearly this will cause a conflict with anyone else who has created a function called “my_gallery_shortcode”. Please rename this function to something more specific to your theme, like “tagdiv_gallery_shortcode” or “newspaper_gallery_shortcode”.

In the same function the $ouptut variable is assumed to be empty, but the output variable for galleries is not always empty and if another plugin generates output before “my_gallery_shortcode”, then “my_gallery_shortcode” discards the previous output. I recommend you check if there is output. If there is output, then just return it without rendering the theme-specific gallery. E.g.


if ( $output != '' ) {
	return $output;
}

Edit: As an aside, the phpdoc for the my_gallery_shortcode is wrong. The filter should only accept 3 arguments: $output, $attr, $instance. See https://core.trac.wordpress.org/browser/trunk/src/wp-includes/media.php#L984

Thanks,
James Kraus

Post count: 7909

Hi,

I send this to the developer and also I add it on our list and we will fix it as soon as possible.

Thanks for suggestion!

Post count: 780

Hi,

I’ve finally fixed the issues but the we overwrite the output variable specifically to not allow plugins to modify it. If the user selects our gallery we want to make sure that, that’s what it gets.

Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic.