Skip to content

Latest commit

 

History

History
40 lines (27 loc) · 1.03 KB

README.md

File metadata and controls

40 lines (27 loc) · 1.03 KB

WP Shortcodes

The standalone version of WordPress shortcodes system for use outside of WordPress.

Notice: The kses-related parts have been removed from the shortcode system and are currently not supported.

🫡 Usage

🚀 Installation

You can install the package via composer:

composer require nabeghe/wp-shortcodes

📁 Localization Directory

Example

use Nabeghe\WPShortcodes\Shortcodes;

$shortcodes = new Shortcodes();
$shortcodes->add('hash', function ($atts, $content = null) {
    $atts['algo'] ??= 'md5';
    return hash($atts['algo'], $content);
});

$result = $shortcodes->do('
MD5 = [hash algo="md5"]https://github.com/nabeghe/wp-shortcodes[/hash]
SJA256 = [hash algo="sha256"]https://github.com/nabeghe/wp-shortcodes[/hash]
');
echo $result;

📖 License

Copyright (c) 2024 Hadi Akbarzadeh

Licensed under the GPL-2.0+ license, see LICENSE.md for details.