Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $shortcode = 'hi';
- function page_init()
- {
- ?>
- <form action='<?php echo admin_url( 'admin.php' ); ?>' method='post'>
- <input type='text' placeholder='Your shortcode(s)' name='shortcode'/>
- <input type="hidden" name="action" value="shortcode_plugin" />
- <input type='submit' value='Appliquer'>
- </form>
- <?php
- }
- add_action( 'admin_action_shortcode_plugin', 'shortcode_plugin_admin_action' );
- function shortcode_plugin_admin_action($shortcode)
- {
- if(isset($_POST['shortcode']))
- {
- global $shortcode;
- $shortcode = $_POST['shortcode'];
- wp_redirect( $_SERVER['HTTP_REFERER'] );
- exit;
- }
- }
- add_action( 'admin_menu', 'shortcode_plugin_admin_menu' );
- function shortcode_plugin_admin_menu()
- {
- add_management_page( 'Shortcode plugin Test page', 'Shortcode plugin Test page', 'administrator', 'shortcode_plugin', 'shortcode_plugin_do_page' );
- }
- function instaAboveFooter()
- {
- global $shortcode;
- echo do_shortcode($shortcode);
- }
- add_action( 'get_footer', 'instaAboveFooter' );
Add Comment
Please, Sign In to add comment