On my forum (made in WordPress) I let users add copy to clipboard buttons so they can make code easier to copy. I am using a plugin for this meaning that when you are posting something on the forum and type this then it will make a copy to clipboard button:
[pw-clippy caption="Copy"]Text to Copy goes here[/pw-clippy]
I don’t really like users having to use the name of the plugin ‘pw-clippy’ when making these buttons so I am wondering if I can shorten it so instead you type something like:
[copytoclip caption="Copy"]Text to Copy goes here[/copytoclip]
or this would also be fine:
[copytoclip]Text to Copy goes here[/copytoclip]
This may have an easy solution but I am fairly new to WordPress and would like to learn more.
Thanks for any help.
Note: I am not sure if it is called shortcode but any knowledge on it would be appreciated 😀
Untested but here goes:
Add this to
functions.php
, or even better as a standalone plugin file in yourwp-content/plugins/
directory.