Rich
Rich

Reputation: 37

How to call shortcodes on link or button press from a wordpress template

I have plugin that I wrote that adds a menu item to the Wordpress dashboard, which when selected, shows a template page that is coded in Templates/admin.php file.

This works, but now I am looking for an example of how to create a list of links or buttons that will call do_shortcode() for various functions from within the admin.php template.

I am currently creating a page for each with a shortcode call on it and using a sub menu item in the Dashboard to call that page, but I would really like to be able have a single control panel in Templates/admin.php verses sub-menu buttons that simply fire the shortcode via a page load.

<ul>
<li> do shortcode1 </li> // links to fire shortcode1, etc.
<li> do shortcode2 </li>
<li> do shortcode3 </li>
</ul>

I think the only way is to create a form that has various buttons which use the submit to calls a javascript function which then calls the do_shortcode('[shortcode1]') function.

I am thinking that there is a better way, but not sure. Any help or examples would be greatly appreciated.

Upvotes: 0

Views: 96

Answers (0)

Related Questions