Home Forums WoodMart support forum Short Code Registration & Gutenberg

Short Code Registration & Gutenberg

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #643215

    copacetic
    Participant

    What is the best way to register a short code with Woodmart.

    I am trying to create short code to use in the Product Layout template that will display and image or a video via ACF that my team will use.

    In order to test I create a simple shortcode that outputs a string.

    add_shortcode('shortcode_test', 'display_shortcode_test');
    function display_shortcode_test() {
        // Restrict to single product pages only
        if (!is_singular('product')) {
            return '';
        }
    
        // Return test string
        return 'Short Code Test';
    }

    I then use the Gutenberg short code block on the Single Product Layout from Woodmart with the following [shortcode_test].

    However on the front end its just displays plain text: [shortcode_test]

    its almost as if its not registering it.

    I am using the lates Woodmart with a child theme.

    Thanks

    #643352

    Hung Pham
    Keymaster

    Hi copacetic ,

    Thanks for reaching to us.

    Please refer to this article for more details https://www.wpbeginner.com/wp-tutorials/how-to-add-a-shortcode-in-wordpress/

    Regards,

Viewing 2 posts - 1 through 2 (of 2 total)