Home › Forums › WoodMart support forum › Short Code Registration & Gutenberg
Short Code Registration & Gutenberg
- This topic has 4 replies, 2 voices, and was last updated 5 months ago by
Hung Pham.
-
AuthorPosts
-
March 6, 2025 at 12:07 am #643215
copaceticParticipantWhat 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
March 6, 2025 at 12:01 pm #643352
Hung PhamKeymasterHi 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,
March 21, 2025 at 10:42 pm #648052
copaceticParticipantI followed the article above and nothing works. The shortcode just gets printed to the page. See attached image.
Basically I am trying to add a custom pixel to my checkout page and it does not work. I tried in my checkout page. I also wanted to the same in my Single Product Layout page. Nothing.
I added credentials below for you to check out on my staging site.
Its strange becuase the checkout page is just the standard Woo checkout and that is just a shortcode.
However, if I add my shortcode it just prints out the shortcode to the page.Im running the latest version of Woodmart with the Furniture 2 import.
I have a simple test shortcode in functions. I also created a separate plug in that outputs and nothing.
Attachments:
You must be logged in to view attached files.March 22, 2025 at 1:45 am #648059
copaceticParticipantI believe I was able to solve the issue. Thank you
March 22, 2025 at 10:57 am #648102
Hung PhamKeymasterHi copacetic,
Glad to hear your issue has been resolved. Keep us in mind for future questions and concerns, we’re always here to help!
Regards,
-
AuthorPosts
- You must be logged in to create new topics. Login / Register