Embed a Carousel in a Theme Template

If you build or customise themesThemeA collection of templates and styles that controls how your site looks., you can place a carousel directly in a template file instead of inside page content – handy for a homepage hero, a header, or a footer banner.

Use do_shortcode()

Render any slider in a PHPPHPThe server-side programming language WordPress is written in. template with WordPress’s do_shortcode(), passing the slider ID you copied from the Sliders screen:

<?php echo do_shortcode( '[neo_carousel_shortcode id="42"]' ); ?>

This works in any PHP template file – for example front-page.php, header.php, page.php, a custom page template, or a widgetWidgetA small content block you place into a sidebar or widget area. area.

Pass shortcode attributes

The same attributes the shortcode accepts can be passed here too:

<?php echo do_shortcode( '[neo_carousel_shortcode id="42" interval="3000" pause="hover"]' ); ?>

See Display a Carousel with the Shortcode for the full list of attributes.

Customise the output

To change the HTML a carousel renders, use the nbc_shortcode_filter – see Customize the Carousel Output and the Hooks and Filters Reference.

Updated on June 14, 2026

Was this article helpful?

Related Articles