I'm trying to build a custom plugin that allows users to edit templates and export as HTML.
I need help with the following:
I've setup the templates as a custom post type and added meta boxes using the Metabox plugin.
I've tried adding an additional meta box which acts as a button, but instead of directing the user to the &submit=true, it updates the post.
Here is the code:
function add_export_meta_box(){
add_meta_box('peg-export', 'Export', 'export_meta_box', 'email-template', 'side', 'low');}
add_action('add_meta_boxes', 'add_export_meta_box');
function export_meta_box()
{?>
<form method="post" enctype="application/x-www-form-urlencoded" action="?page=<?php echo $_GET['page']?>&export=true">
<input type="hidden" name="export" value="1">
<input type="submit" class="button button-primary button-large" value="Export Template" id="export-template"/>
</form>
<?php }
Once the button is successfully working, I'm unsure how to get the page to download the template inside the browser.
I'm a little out of my depth here, so I'd appreciate any help.
Muchos gracias, :)