Join

How to Adjust the Mail Share Option for MyListing Single Listings

  • Guides reflect how I’m currently using the solution for myself and my clients. 
  • If I don’t cover a specific feature, it implies I’m not using it.
  • If I don’t cover a specific setting, it implies the defaults are acceptable or the options are obvious.

This guide will show you how to adjust the content of the emails sent when using the mail share option for MyListing Single Listings.

  1. Browse to the following directory structure within the parent theme: /wp-content/themes/my-listing/includes/extensions/sharer/
  2. Copy the sharer.php file to your local workstation and edit it with a text editor application.
  3. Replace the contents in the ‘Before’ snippet with those of the ‘After” snippet.
  4. Adjust the lines below to match your desired text.
rawurlencode( 'I Would Like to Share a Listing From '.get_bloginfo('name') ),
'Hi. I thought you might be interested in the following Listing.' . "%0D%0A%0D%0A".

Before

public function mail( $options ) {
	if ( empty( $options['title'] ) || empty( $options['permalink'] ) ) {
		return;
	}

	$url = sprintf(
		'mailto:?subject=%s&body=%s',
		rawurlencode( '['.get_bloginfo('name').'] ' . $options['title'] ),
		rawurlencode( $options['permalink'] )
	);

	return $this->get_link_template( [
		'title' => _x( 'Mail', 'Share dialog', 'my-listing' ),
		'permalink' => $url,
		'icon' => 'fa fa-envelope-o',
		'color' => '#e74c3c',
		'popup' => false,
	] );
}

After

public function mail( $options ) {
if ( empty( $options['title'] ) || empty( $options['permalink'] ) ) {
 return;
}
$url = sprintf(
	'mailto:?subject=%s&body=%s',
 	rawurlencode( 'I Would Like to Share a Listing From '.get_bloginfo('name') ),
 	'Hi. You might be interested in the following Listing.' . "%0D%0A%0D%0A".
$options['title'].'%0D%0A'.
$options['permalink']
);

return $this->get_link_template( [
	'title' => _x( 'Mail', 'Share dialog', 'my-listing' ),
	'permalink' => $url,
	'icon' => 'fa fa-envelope-o',
 	'color' => '#e74c3c',
 	'popup' => false,
] );
	   }
  1. Browse to the following directory structure within the child theme: /wp-content/themes/my-listing-child/includes/extensions/sharer/
  2. Copy the sharer.php file from your local workstation and place it in the folder from the previous step.
  3. Test

Once you complete the above steps, you should have an email with the following content.

Subject:
I Would Like to Share a Listing From <Website Name>

Body:
Hi. I thought you might be interested in the following Listing. 

<Listing Title>
<Listing URL>

Youtube video