Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Overwrites the push notification title only for iOS for the AppPush plugin when sending
- * push notification for a regular post.
- *
- * Place this file in the wp-content/mu-plugins folder.
- * The mu-plugins folder is not there by default, you may have to create it.
- */
- function custom_push__ios( $data ) {
- global $post;
- if( ! isset( $post ) ) {
- return $data;
- }
- if( !isset( $data['custom'] ) ) {
- $data['custom'] = array();
- }
- /**
- * Sample:
- *
- * Overwrite the title and message for iOS only.
- *
- */
- $data['custom']['ios'] = array(
- // When the app is open, the title of the alert pop-up
- 'title' => 'the alert message',
- // When the app is closed, the text in the notification tray
- // and when the app is open, the text of the alert pop-up
- 'alert' => $post->post_title,
- );
- return $data;
- }
- add_filter( 'ap3_send_push_data', 'custom_push__ios', 10, 1 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement