Guest User

Untitled

a guest
Jan 18th, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. $shortcode = 'hi';
  2.  
  3. function page_init()
  4. {
  5. ?>
  6. <form action='<?php echo admin_url( 'admin.php' ); ?>' method='post'>
  7. <input type='text' placeholder='Your shortcode(s)' name='shortcode'/>
  8. <input type="hidden" name="action" value="shortcode_plugin" />
  9. <input type='submit' value='Appliquer'>
  10. </form>
  11. <?php
  12.  
  13. }
  14.  
  15. add_action( 'admin_action_shortcode_plugin', 'shortcode_plugin_admin_action' );
  16. function shortcode_plugin_admin_action($shortcode)
  17. {
  18. if(isset($_POST['shortcode']))
  19. {
  20. global $shortcode;
  21. $shortcode = $_POST['shortcode'];
  22.  
  23. wp_redirect( $_SERVER['HTTP_REFERER'] );
  24. exit;
  25. }
  26.  
  27. }
  28.  
  29. add_action( 'admin_menu', 'shortcode_plugin_admin_menu' );
  30. function shortcode_plugin_admin_menu()
  31. {
  32. add_management_page( 'Shortcode plugin Test page', 'Shortcode plugin Test page', 'administrator', 'shortcode_plugin', 'shortcode_plugin_do_page' );
  33. }
  34.  
  35. function instaAboveFooter()
  36. {
  37. global $shortcode;
  38. echo do_shortcode($shortcode);
  39. }
  40. add_action( 'get_footer', 'instaAboveFooter' );
Add Comment
Please, Sign In to add comment