Created
April 10, 2019 17:16
-
-
Save stillatmylinux/f28bf79f2989303156fc19162fa91b9f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment