Before-After Slider for WordPress - No Plugin Needed

Most WordPress before-after slider plugins are bloated - they load extra CSS, JavaScript, and sometimes even jQuery just for one UI component. You can skip all of that. One lightweight script tag and a Custom HTML block is all you need.
The slider above is a live demo. That exact component will be on your WordPress site in about two minutes.
Step 1: Add the script tag
You need to load the OneType Transforms script on your site once. The easiest way is with the free WPCode plugin (2M+ installs):
- Go to Plugins > Add New
- Search for WPCode
- Click Install Now, then Activate
- Go to Code Snippets > Header & Footer
- Paste this in the Header section:
<script src="https://cdn.transforms.onetype.ai/script/57095981335841558d328d599e6f5322.js"></script>
- Click Save Changes
Done. The script now loads on every page of your WordPress site. No account needed - the before-after slider is free.
Step 2: Add the slider to a page
Gutenberg (Block Editor)
- Edit the page where you want the slider
- Click the + button to add a new block
- Search for Custom HTML and select it
- Paste this:
<div ot="before-after">
<img src="YOUR_BEFORE_IMAGE_URL" alt="Before">
<img src="YOUR_AFTER_IMAGE_URL" alt="After">
</div>
- Replace the image URLs with your actual images (upload them in Media Library first and copy the URLs)
- Save or publish the page
Classic Editor
- Click the Text tab (top right of the editor, next to Visual)
- Paste the same HTML code
- Save or publish
WordPress.com users
If you are on WordPress.com (not self-hosted), it depends on your plan:
- Business or Commerce plan - works exactly like self-hosted. Install WPCode, add the script tag, use Custom HTML blocks.
- Free, Personal, or Premium plans - you cannot install plugins. Instead, add both the script tag and the slider HTML together in a single Custom HTML block on each page.
For lower WordPress.com plans, paste this in a Custom HTML block:
<script src="https://cdn.transforms.onetype.ai/script/57095981335841558d328d599e6f5322.js"></script>
<div ot="before-after">
<img src="before.jpg" alt="Before">
<img src="after.jpg" alt="After">
</div>
Customization
All options are HTML attributes on the same div:
- ot-direction="vertical" - slide top to bottom
- ot-label-before="Original" - label on the before side
- ot-label-after="Edited" - label on the after side
- ot-position="30" - start at 30% instead of 50%
- ot-hover="true" - follow mouse instead of drag
Why not just use a plugin?
You can, but most before-after slider plugins add a lot of overhead. They load their own CSS frameworks, JavaScript libraries, admin panels, and settings pages. Some still depend on jQuery.
With OneType Transforms, you get a single lightweight script that only loads what you use. No admin panel, no settings page, no database entries. Just HTML attributes.
And the before-after slider is completely free. Check out the main before-after slider guide for all customization options, or browse more transforms at transforms.onetype.ai.