Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1.  
  2. // We need to get following code to work.
  3. // We need to make sure all fields is passed when clicking on the button in the "Tilbud" post type + ACF fields.
  4.  
  5. add_action( 'post_submitbox_misc_actions', 'custom_button' );
  6.  
  7. function custom_button( $post ){
  8.  
  9. //Don't show button, if post type arn't tilbud
  10. if ('tilbud'!== $post->post_type ): return; endif;
  11.  
  12. //Execute button to convert to order
  13. var_dump($post);
  14. ?>
  15.  
  16. <form action="<?php admin_url('admin-post.php') ?>" method="POST">
  17. <!-- your inputs -->
  18. <input type="hidden" name="action" value="convert_to_order"/>
  19. <input type="submit" value="Send"/>
  20. </form>
  21.  
  22. <?php }
  23.  
  24.  
  25. add_action( 'admin_post_nopriv_convert_to_order',array( "class_that_owns_that_function", 'convert_to_order_function' ) );
  26.  
  27. function convert_to_order_function()
  28. {
  29. wp_die('hello');
  30. // Do what you want with $_POST variables
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement