Customize the Carousel Output

When you need to change the markup a carousel emits – to wrap it in a container, add a heading, or post-process the HTML – use the nbc_shortcode_filter.

The filter

It passes the rendered HTML and the shortcode attributes, and expects you to return the (possibly modified) HTML.

add_filter( 'nbc_shortcode_filter', function ( $output, $atts ) {
	return '<div class="my-carousel-wrap">' . $output . '</div>';
}, 10, 2 );

Tips

  • Return a string. Returning an empty string hides the carousel.
  • Use $atts['id'] to target a single carousel only.
  • Escape any dynamic values you add to the output.

For the full hook list, see the Hooks and Filters Reference.

Updated on June 14, 2026

Was this article helpful?

Related Articles