Advertisement
Guest User

Untitled

a guest
Apr 20th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4. * Overwrites the push notification title only for iOS for the AppPush plugin when sending
  5. * push notification for a regular post.
  6. *
  7. * Place this file in the wp-content/mu-plugins folder.
  8. * The mu-plugins folder is not there by default, you may have to create it.
  9. */
  10.  
  11. function custom_push__ios( $data ) {
  12.  
  13. global $post;
  14.  
  15. if( ! isset( $post ) ) {
  16. return $data;
  17. }
  18.  
  19. if( !isset( $data['custom'] ) ) {
  20. $data['custom'] = array();
  21. }
  22.  
  23.  
  24. /**
  25. * Sample:
  26. *
  27. * Overwrite the title and message for iOS only.
  28. *
  29. */
  30.  
  31. $data['custom']['ios'] = array(
  32.  
  33. // When the app is open, the title of the alert pop-up
  34. 'title' => 'the alert message',
  35.  
  36. // When the app is closed, the text in the notification tray
  37. // and when the app is open, the text of the alert pop-up
  38. 'alert' => $post->post_title,
  39. );
  40.  
  41. return $data;
  42. }
  43. add_filter( 'ap3_send_push_data', 'custom_push__ios', 10, 1 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement