I am a newbie in WordPress not totally but 6 months. So I am finding the new thing and practicing on WordPress. I want to know that how can I implement shortcode on click event means

I have a buttons on my index.php page like this:


and with these video and audio buttons, I want to attach the WordPress inbuilt video and audio shortcodes and if I click on any of the two buttons.

suppose if I have clicked on video button the video tag appears under the video buttons and when I again click on video button the video the video tag again disappears.

  • 1
    For me it sounds like a wrong approach to solve your problem. Shortcodes in Wordpress are used in the editor texarea and output the appropriate HTML when the page is rendered. Click events happen on the javascript side. So "implement shortcodes on click event" can't work. What you could do is program a shortcode function that renders out the video/audio buttons stuff (HTML) and the related javascript (inline) as well.
    – Luckyfella
    Jul 14, 2017 at 12:30


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.