rockschtar / wordpress-shortcode
Library for simple wordpress shortcode creation
Installs: 2 247
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Forks: 0
pkg:composer/rockschtar/wordpress-shortcode
Requires
- php: >=7.1
Requires (Dev)
- brain/monkey: 2.*
- phpunit/phpunit: ^7
This package is auto-updated.
Last update: 2024-04-19 16:28:00 UTC
README
Requirements
- PHP 7.1+
- Composer to install
License
rockschtar/wordpress-shortcode is open source and released under MIT license. See LICENSE file for more info.
Usage
Create a shortcode class
class TestShortcode extends AbstractShortcode {
public function getShortcodeName(): string {
return 'myshortcode';
}
public function display_shortcode($attributes): string {
$parsed_attributes = wp_parse_args($attributes, ['foo' => 'bar']);
$output = 'This is my shortcode ' . $parsed_attributes['foo'];
return $output;
}
}
Initialize the class
TestShortcode::init();
Question? Issues?
rockschtar/wordpress-shortcode is hosted on GitLab. Feel free to open issues there for suggestions, questions and real issues.