Advertisement
Guest User

Untitled

a guest
Apr 19th, 2015
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. add_action('save_post', 'createGallery');
  2.  
  3. function createGallery () {
  4. global $post;
  5. if ( $post->post_type == 'activity' ) {
  6. $gallerypost = array(
  7. 'post_content' => 'the text of the post',
  8. 'post_status' => 'publish',
  9. 'post_title' => 'Photo album',
  10. 'post_type' => 'post',
  11. 'post_author' => 1);
  12. wp_insert_post( $gallerypost );
  13. }
  14. }
  15.  
  16. do_action('save_post', $post_ID, $post);
  17.  
  18. add_action('save_post', 'createGallery',1,1);
  19.  
  20. function createGallery ($post_ID) {
  21. if ( get_post_type($post_ID) == 'activity' ) {
  22. $gallerypost = array(
  23. 'post_content' => 'the text of the post',
  24. 'post_status' => 'publish',
  25. 'post_title' => 'Photo album',
  26. 'post_type' => 'post',
  27. 'post_author' => 1);
  28. wp_insert_post( $gallerypost );
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement