Smart RTL Post

Description

Smart RTL Post allows you to easily apply RTL styling to selected posts, pages, and custom post types.

Features

  • Enable RTL per post
  • Gutenberg editor support
  • Custom post types support
  • Lightweight plugin
  • Clean uninstall
  • No performance impact
  • Custom fonts support

  • Works on Posts and Pages (and any post type via filter hook)

  • Native Block Editor (Gutenberg) sidebar panel — no Classic Editor required
  • Settings page to choose default direction, font, font size, and line height
  • Shortcode [rtl]your text[/rtl] for inline RTL content inside any post
  • Google Fonts support: Noto Nastaliq Urdu, Scheherazade New, Amiri, Lateef
  • CSS only loaded when actually needed (performance friendly)
  • RTL styles scoped to content area only — navigation and header stay unaffected
  • Developer-friendly: smart_rtl_supported_post_types filter to add custom post types
  • Clean uninstall — removes all options and post meta when deleted

Shortcode Usage

Use inside any post or page:
[rtl]Your text here[/rtl]

Add Custom Post Type Support

Add this to your theme’s functions.php:

add_filter( 'smart_rtl_supported_post_types', function( $types ) {
    $types[] = 'product';
    return $types;
} );

`

License

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 or later.
For more details, visit: https://www.gnu.org/licenses/gpl-2.0.html

Installation

  1. Upload the smart-rtl-post folder to /wp-content/plugins/
  2. Activate the plugin from the Plugins page in WordPress
  3. Go to Settings > Smart RTL Post to configure defaults
  4. Edit any post or page and select the direction from the sidebar

FAQ

Does this work with the Block Editor (Gutenberg)?

Yes. A native sidebar panel appears in the Document Settings for both Classic Editor and Block Editor.

Can I use it on WooCommerce product pages?

Not by default, but you can easily add any custom post type using the smart_rtl_supported_post_types filter (see Description).

Will this slow down my site?

No. The CSS file is only loaded on pages where RTL direction is actually enabled.

Which fonts are available?

Noto Nastaliq Urdu, Scheherazade New, Amiri, Lateef, and a System Serif (no Google Fonts) option.

Does changing direction break my site navigation?

No. Since v1.3.0 the RTL direction is scoped to post content areas only. Your header, navigation menus, and footer are not affected.

What happens when I delete the plugin?

All options and post meta are automatically removed from the database.

Reviews

juli 13, 2025
I was looking for a simple way to switch my blog posts to right-to-left, and this plugin does exactly that. No extra setup, no confusion — just one click and everything aligns perfectly for RTL languages. It works great for Urdu and Arabic content. The plugin is lightweight and doesn’t slow down the site. Highly recommended for anyone managing RTL content! Thanks to the developer for this helpful tool.
juli 13, 2025
This plugin is a game-changer!With just one click, it perfectly switches the post layout to RTL for languages like Urdu, Arabic, and Pashto. I’ve tested it on both the Gutenberg and Classic editors, and it works flawlessly on both. I especially appreciate how clean and lightweight it is — no unnecessary settings, no complications. Just activate, click, and done. Simple and effective! If you’re running a multilingual or RTL-focused site, this plugin is a must-have. Kudos to the developer!
Read all 2 reviews

Contributors & Developers

“Smart RTL Post” is open source software. The following people have contributed to this plugin.

Contributors

Translate “Smart RTL Post” into your language.

Interested in development?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.

Changelog

1.5.1

  • Fixed: CSS inline values (font_size, line_height) explicitly re-sanitized before injection — absint() and range clamp added
  • Fixed: WordPress.org submission zip now uses correct folder name ‘smart-rtl-post’ (no version suffix)
  • Confirmed: WP_UNINSTALL_PLUGIN check present in uninstall.php
  • Confirmed: Plugin slug, Text Domain, and load_plugin_textdomain are all ‘smart-rtl-post’ — consistent
  • Confirmed: No raw variable outputs — all echo uses esc_html/esc_attr/esc_url/wp_kses_post

1.5.0

  • Added: register_activation_hook — sets default options on clean install using add_option() with autoload=no
  • Added: autoload=false on all register_setting() calls (WP 6.0+) — prevents options loading on every page, improves performance
  • Added: readme.txt tags now include ‘direction’ and ‘gutenberg’ for better WordPress.org search visibility
  • Confirmed: WP_UNINSTALL_PLUGIN security check already present in uninstall.php
  • Confirmed: CSS loads conditionally — only on RTL posts or when [rtl] shortcode detected

1.4.2

  • Fixed: transition_post_status condition tightened — now only fires when status changes exactly TO publish FROM non-publish (avoids publishdraft, publishtrash edge cases)
  • Fixed: Multisite uninstall now uses batch processing (100 sites per loop) — prevents server hang on large networks
  • Fixed: Added wp-block-code to CSS RTL selectors
  • Fixed: Version bumped in rtl-style.css, block-editor.js, and SMART_RTL_VERSION constant — all in sync
  • Fixed: .pot file updated to version 1.4.2; all 20 strings verified with correct text-domain
  • Fixed: readme.txt Stable tag matches plugin Version header — WordPress.org consistency

1.4.1

  • Fixed: Version comments in rtl-style.css and block-editor.js updated to 1.4.1
  • Fixed: wp_insert_post replaced with transition_post_status hook — default direction now only saves on actual publish/schedule, not on every draft save
  • Fixed: Multisite support added to uninstall.php — all sub-sites cleaned up on network delete
  • Fixed: Added missing Gutenberg block selectors: wp-block-table, wp-block-group, wp-block-columns, wp-block-column, wp-block-cover, wp-block-media-text
  • Added: languages/smart-rtl-post.pot translation template file for Urdu/Pashto/Arabic translators

1.4.0

  • Fixed: Default direction now saved to database on first publish (was only shown in UI before)
  • Fixed: Gutenberg detection now uses reliable use_block_editor_for_post_type() instead of get_current_screen()
  • Fixed: line-height setting was registered but never actually applied — now works correctly
  • Fixed: Shortcode CSS now loads even in LTR posts (has_shortcode() detection added)
  • Fixed: Google Fonts now properly enqueued via wp_enqueue_style (font was named but never loaded)
  • Fixed: Shortcode [rtl] inline styles replaced with CSS class for better SEO and performance
  • Fixed: .smart-rtl-inline now inherits font-family, font-size, line-height from settings

1.3.1

  • Improved get_current_screen() safety check to prevent rare admin errors
  • Improved auth_callback to use post-specific edit_post capability (WordPress review standard)
  • Added wp_style_is() check before wp_add_inline_style() for safer CSS injection
  • Added explicit load_plugin_textdomain() for non-WordPress.org distributions
  • Added Settings link in Plugins list page for easier access

1.3.0

  • Added native Block Editor (Gutenberg) sidebar panel via PluginDocumentSettingPanel
  • Added Font Size setting (14 – 32px, default 18px) — useful for Urdu/Pashto readability
  • Fixed shortcode: now uses saved font setting instead of hardcoded font families
  • Fixed CSS scope: RTL direction no longer applied to full body (navigation/header unaffected)
  • Added uninstall.php — cleans up all options and post meta on plugin deletion

1.2.0

  • Added support for Pages (not just Posts)
  • Added Settings page (default direction, font chooser, line height)
  • Added [rtl]...[/rtl] shortcode for inline RTL text
  • CSS now loads conditionally — only on RTL pages
  • Google Fonts support (Noto Nastaliq Urdu, Scheherazade New, Amiri, Lateef)
  • Improved CSS to target common block editor content wrappers
  • Added smart_rtl_supported_post_types filter for developers
  • Added Requires PHP: 7.4 header

1.0.0

  • Initial release.