With versions 1.3 and greater of Post Promoter Pro, you can edit the default share text. It also includes the ability use token replacements like {post_title} and {site_title} to be dynamically replace at the time of sharing. It’s really simple to add your own tokens to the list of replacements.

Adding a token

First, you need to register your new token:

function ck_ppp_add_my_tokens( $tokens ) {
    $tokens[] = array( 'token'        => 'my_token', 
                       'description' => __( 'What my token does', 'ppp-txt' ) );

    return $tokens;
add_filter( 'ppp_text_tokens', 'ck_ppp_add_my_tokens', 10, 1 );

The elements of the array are:

  • token – The token you are registering, without curly braces { and }. It’s preferred that these be snake case, or contain ‘_’ instead of spaces or dashes.
  • description – What this replacement is

Both of these array elements are required. When completed you should see your token in the help context of the Default Share Text:
Screen Shot 2014-05-30 at 12.40.10 AM

Replacing a token

To execute the replacement of your token, you will hook into the ‘ppp_replace_token-*’ filter:

function ck_ppp_replace_my_token( $string, $args ) {
    return preg_replace( '"\{my_token\}"', 'My Replacement String Here', $string );
add_filter( 'ppp_replace_token-my_token', 'ck_ppp_replace_my_token', 10, 2 );