AppThemes Docs

Filters to Customize Vantage Emails

This is an advanced documentation intended for website developers. In this documentation you will find the information needed to customize the emails sent from the Vantage AppTheme. These filters give you the ability to fully customize the emails.

Notification Filter Code

This is the code you will need to add to the Vantage theme to use the notification filters.

/**
* Filter the Listing standard notifications.
*
* The dynamic portions of the hook name, `$id`, refer to the particular
* notification type.
*
* @since 1.0
*
* @param array $args An array of wp_mail() arguments, including the
*  "to", "subject", "message", "headers",
*  "attachments" and other custom values (for ex. "listing" and "order").
*/
$args = apply_filters( "appthemes_{$id}", $args );

Notification Filters

These parameters can be used in the code above for the $args variable.

These filters can be used to replace the ($id)

Usage Example:

For example we want to change the content of the listing expired email.

notify_user_expired_listing. Prepend appthemes_ to get the filter name: appthemes_notify_user_expired_listing

function my_custom_notify_user_expired_listing( $args ) {

$blogname    = wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES );
$post        = $args['listing'];
$recipient   = get_user_by( 'id', $post->post_author );
$permalink   = html_link( get_permalink( $post ), $post->post_title );
$listing_mod = APP_Listing_Director::get( VA_LISTING_PTYPE );
$renew_link  = html_link( $listing_mod->view_process_renew->basic_url( $post->ID ) );

// Change the Subject.
$args['subject'] = sprintf( __( '[%1$s] Ohhh No! Listing "%2$s" just has been expired on the %1$s' ), $blogname, $post->post_title );

// Change content.
$args['message'] = <<<EOT
<h1>Hey {$recipient->display_name}!</h1>
<p>We just letting you know that Your listing: "$permalink" has been expired (it is not visible to the public anymore).</p>
<h2>Make Your listing great again!</h2>
<p>Renew and re-publish it again using following link: $renew_link</p>

Yours,
$blogname team
EOT;

return $args;
}
add_filter( 'appthemes_notify_user_expired_listing', 'my_custom_notify_user_expired_listing' );
Your rating: none
Rating: 3.5 - 2 votes