rockschtar/wordpress-shortcode

Library for simple wordpress shortcode creation

1.0.0 2021-10-12 12:21 UTC

This package is auto-updated.

Last update: 2022-06-12 11:39:06 UTC


README

Requirements

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.