WordPress Carousel - How to Add One Without a Plugin

Add a responsive carousel slider to WordPress without a plugin. Lightweight CDN script, HTML attributes, works with Gutenberg and page builders.

Stefan Pakic

March 03, 2026

4 mins read

Table of content

Create your website visually – fast and easy.

Build a stunning website with ease using our visual builder. No experience needed – just drag, drop, and launch your site today.

Live Preview

WordPress has hundreds of carousel plugins. Most load 200KB+ of JavaScript, add admin bloat, and slow down your site. If all you need is a clean carousel slider, that's overkill.

Here's a lighter approach: add a single script tag and use HTML attributes. No plugin to install, no settings page to configure, no database queries on every page load. The carousel runs entirely from a CDN - your WordPress install stays clean.

This guide uses the Swiper carousel from OneType Transforms - a premium component that works on any site, including WordPress. For the full overview of features and effects, see the main carousel slider guide.

Step 1: Add the script tag

The Swiper carousel is a premium transform. Sign up for a Pro or Agency plan at transforms.onetype.ai/pricing, then grab your script tag from the Get Started page.

The easiest way to add the script site-wide is with the free WPCode plugin (2M+ installs):

  1. Go to Plugins > Add New, search "WPCode", install and activate
  2. Go to Code Snippets > Header & Footer
  3. Paste your script tag in the Header section
  4. Click Save Changes
<script src="https://cdn.transforms.onetype.ai/bundle/{YOUR-TOKEN}.js"></script>

This loads the script on every page of your WordPress site. One-time setup.

Developer alternative: If you prefer code over plugins, add this to your child theme's functions.php:

function add_onetype_transforms() {
    wp_enqueue_script(
        'onetype-transforms',
        'https://cdn.transforms.onetype.ai/bundle/{YOUR-TOKEN}.js',
        array(),
        null,
        false
    );
}
add_action('wp_enqueue_scripts', 'add_onetype_transforms');

In the Gutenberg editor, add a Custom HTML block where you want the carousel:

  1. Click the + button to add a new block
  2. Search for Custom HTML
  3. Paste the carousel HTML
<div ot="swiper" ot-navigation="true" ot-pagination="bullets">
    <div><img src="https://your-site.com/image-1.jpg" alt="Slide 1"></div>
    <div><img src="https://your-site.com/image-2.jpg" alt="Slide 2"></div>
    <div><img src="https://your-site.com/image-3.jpg" alt="Slide 3"></div>
</div>

Save and preview the page. The carousel activates on the live site - you won't see it in the Gutenberg editor preview.

WordPress.com vs WordPress.org

If you're on self-hosted WordPress.org, everything above works out of the box. Install WPCode, add the script, done.

If you're on WordPress.com, it depends on your plan:

  • Business or Commerce plan ($25+/mo) - full access. Install WPCode, same as self-hosted.
  • Free, Personal, or Premium plan - can't install plugins. Add both the script tag and carousel HTML together in a Custom HTML block on each page.

If you use Elementor, Divi, or Beaver Builder instead of Gutenberg, the process is the same idea - just different UI:

  • Elementor - use the HTML widget to add the carousel markup. Elementor Pro users can also use Elementor > Custom Code instead of WPCode for the script tag.
  • Divi - use a Code Module for the carousel HTML. Add the script in Divi > Theme Options > Integration > Head.
  • Beaver Builder - use an HTML Module. Add the script via WPCode or the BB Theme's Head Code setting.

Image gallery with autoplay:

<div ot="swiper" ot-autoplay="true" ot-autoplay-delay="4000" ot-loop="true" ot-pagination="bullets">
    <div><img src="gallery-1.jpg" alt="Photo 1"></div>
    <div><img src="gallery-2.jpg" alt="Photo 2"></div>
    <div><img src="gallery-3.jpg" alt="Photo 3"></div>
</div>

Multi-card product showcase:

<div ot="swiper" ot-slides-per-view="3" ot-space-between="20" ot-navigation="true">
    <div class="product-card">Product 1</div>
    <div class="product-card">Product 2</div>
    <div class="product-card">Product 3</div>
    <div class="product-card">Product 4</div>
</div>

Testimonial slider with fade effect:

<div ot="swiper" ot-effect="fade" ot-autoplay="true" ot-autoplay-pause="true" ot-pagination="bullets">
    <div>"Great product, saved us hours." - Sarah K.</div>
    <div>"Simple to set up, works perfectly." - Mike R.</div>
    <div>"Best slider solution we've tried." - Team at Acme</div>
</div>

Why not use a WordPress slider plugin?

Slider plugins like Revolution Slider, Smart Slider, or MetaSlider are full-featured tools. They're great if you need a visual editor with drag-and-drop slide building, animation timelines, and template libraries. But they come with tradeoffs:

  • Heavy JavaScript and CSS (200-500KB+ per page)
  • Admin dashboard overhead and database queries
  • Plugin conflicts with themes and other plugins
  • Locked to WordPress - can't reuse on other platforms

The OneType approach loads only what you use from a CDN. No admin panel, no database, no plugin updates to manage. And the same script tag works if you move to Webflow, Shopify, or any other platform later.

Troubleshooting

Carousel doesn't show up: Make sure you're viewing the published page, not the Gutenberg editor preview. Custom HTML blocks with external scripts only run on the live site.

Script tag gets stripped: WordPress strips <script> tags from content for users without the unfiltered_html capability. Make sure you're logged in as an Administrator. On multisite, only Super Admins can add scripts in content.

Caching issues: If you use a caching plugin (WP Rocket, LiteSpeed Cache, W3 Total Cache), clear the cache after adding the script tag. Cached pages may not include the new script.

For the full list of carousel options, effects, and advanced configuration, see the complete carousel slider guide. Browse all transforms at transforms.onetype.ai.

Build and publish websites for free

Build and host your site with a custom domain for free. Upgrade anytime for expanded limits.

Build for free

Built in Divhunt

We use cookies.

By clicking “Accept All”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts. View ourCookie Policyfor more information.

Optahunt

Preferences

Manage your cookie preferences.

Essentials

Always Active

These are required for the website to work, like remembering your privacy settings, keeping you logged in, or enabling secure payments.

Performance

These help us understand how people use our site (like which pages are most popular) so we can make improvements.

Personalization

These allow the site to remember your preferences (such as language or region) and provide enhanced features.

Advertising & Targeting

These are used to deliver ads more relevant to you, limit how often you see them, and measure campaign performance.

Save my preferences

You can always change these settings later via ourCookie Policy pagepage, or via the cookie widget placed at the bottom left of the page.