Listing Sharing Options for MyListing

The Listing Sharing Options for MyListing guide will show you to customize the theme’s sharing options for Listings, by removing social network options that no longer exist or those you might want to remove as a preference.

We also show you how to adjust the design of the email that’s generated with the Mail sharing option.

MyListing Directory Structure

If you’ve never modified the sharer.php file before or you started out your MyListing journey with version 2.0 (or higher), you can just skip down to the MyListing Version 2.x Structure section. 

MyListing Version Pre-2.0 Structure

The versions of MyListing prior to 2.0, used a sharing options path of /my-listing/includes/integrations/27collective/share/.

Assuming you’re using the MyListing Child Theme, the structure you would create in order to modify the sharing options and prevent them from being overwritten with theme updates would be /my-listing-child/includes/integrations/27collective/share/.

You would have then placed a copy of the sharer.php file into the share directory and modified it to fit your requirements, which will need to change, as we discuss in the next section.

MyListing Version 2.x Structure

With the release of the 2.0 version of MyListing, the sharing options path changed to /my-listing/includes/extensions/sharer/.

So, if you’ve modified the sharer.php in the past, all you need to do is adjust the new sharing options path to the new 2.x structure, and you’re done.

That path would be /my-listing-child/includes/extensions/sharer/.

If this is your first time modifying the sharing options, simply create the /my-listing-child/includes/extensions/sharer/ path using FTP application (recommended), your website hosting’s cPanel/dashboard, or the File Manager plugin.

Note: We recommend testing this out in a staging environment first, before touching your live website.

MyListing Sharer File

In this section, we show you how the new Mail share option will look, provide the new sharer.php file, and show you how to edit the file to further meet your requirements

How the Mail Share Option Will Look

If you use the sharer file as-is, the Mail share option will automatically compose an email to contain the content as shown in the screenshot.

We’re pulling in a custom Subject Line, email body text, the title of the Listing, and the URL of the Listing.

Listing Sharing Options Mylisting Mail

New Sharer File

As the file currently sits (shown below), you will be left with the Facebook, Twitter, LinkedIn, Mail, and Copy Link options.

Also, the Mail option has also been adjusted to create a better-formatted e-mail, as previously mentioned.

Simply copy the contents of the new file below into your file, from the previous steps above.


namespace MyListing\Ext\Sharer;

if ( ! defined('ABSPATH') ) {

class Sharer {
	use \MyListing\Src\Traits\Instantiatable;

	public function __construct() {
		add_action( 'wp_head', [ $this, 'add_opengraph_tags' ], 5 );
		add_action( 'wpseo_opengraph', [ $this, 'remove_yoast_duplicate_og_tags' ] );

	public function add_opengraph_tags() {
    	global $post;

    	if ( is_singular( 'job_listing' ) && $listing = new \MyListing\Src\Listing( $post ) ) {
    		$tags = [];

    		$tags['og:title'] = $listing->get_name();
    		$tags['og:url'] = $listing->get_link();
    		$tags['og:site_name'] = get_bloginfo();
    		$tags['og:type'] = 'profile';
    		$tags['og:description'] = $listing->get_share_description();

    		if ( $logo = $listing->get_share_image() ) {
    			$tags['og:image'] = esc_url( $logo );

    		$tags = apply_filters( 'mylisting\single\og:tags', $tags, $listing );

    		foreach ( $tags as $property => $content ) {
    			printf( "<meta property=\"%s\" content=\"%s\" />\n", esc_attr( $property ), esc_attr( $content ) );

	public function remove_yoast_duplicate_og_tags() {
		if ( ! is_singular( 'job_listing' ) ) {
			return false;

		add_filter( 'wpseo_og_og_title',       '__return_false', 50 );
    	add_filter( 'wpseo_og_og_description', '__return_false', 50 );
    	add_filter( 'wpseo_og_og_url',         '__return_false', 50 );
    	add_filter( 'wpseo_og_og_type',        '__return_false', 50 );
    	add_filter( 'wpseo_og_og_site_name',   '__return_false', 50 );
    	add_filter( 'wpseo_og_og_image',       '__return_false', 50 );

	public function get_links( $options = [] ) {
		$options = c27()->merge_options([
			'title' => false,
			'image' => false,
			'permalink' => false,
			'description' => false,
			'icons' => false,
		], $options);

		$options['title'] = wp_kses( $options['title'], [] );
		$options['description'] = wp_kses( $options['description'], [] );

		return apply_filters( 'mylisting\share\get-links', [
			'facebook' 	=> $this->facebook($options),
			'twitter'  	=> $this->twitter($options),
			'linkedin'	=> $this->linkedin($options),
			'mail'		=> $this->mail($options),
			'copy_link' => $this->copy_link($options),
		] );

	public function facebook($options) {
		if ( empty( $options['title'] ) || empty( $options['permalink'] ) ) {

		$url = '';
		$url .= '?u=' . urlencode($options['permalink']);
		$url .= '&title=' . urlencode($options['title']);

		if ($options['description']) $url .= '&description=' . urlencode($options['description']);
		if ($options['image']) $url .= '&picture=' . urlencode($options['image']);

		return $this->get_link_template( [
			'title' => _x( 'Facebook', 'Share dialog', 'my-listing' ),
			'permalink' => $url,
			'icon' => 'fa fa-facebook',
			'color' => '#3b5998',
		] );

	public function twitter( $options ) {
		if ( empty( $options['title'] ) || empty( $options['permalink'] ) ) {

		$url = sprintf(
			urlencode( $options['title'] ),
			urlencode( $options['permalink'] )

		return $this->get_link_template( [
			'title' => _x( 'Twitter', 'Share dialog', 'my-listing' ),
			'permalink' => $url,
			'icon' => 'fa fa-twitter',
			'color' => '#4099FF',
		] );

	public function linkedin( $options ) {
		if ( empty( $options['title'] ) || empty( $options['permalink'] ) ) {

		$url = '';
		$url .= '&url=' . urlencode($options['permalink']);
		$url .= '&title=' . urlencode($options['title']);

		return $this->get_link_template( [
			'title' => _x( 'LinkedIn', 'Share dialog', 'my-listing' ),
			'permalink' => $url,
			'icon' => 'fa fa-linkedin',
			'color' => '#0077B5',
		] );

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

	    $url = sprintf(
            rawurlencode( 'I would like to share a listing from '.get_bloginfo('name') ),
            'Hello. I thought you might be interested in this listing.' . "%0D%0A%0D%0A".

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

	public function print_link( $link ) {
		if ( ! is_string( $link ) || empty( trim( $link ) ) ) {

		echo $link;

	public function get_link_template( $data ) {
		$has_popup = isset( $data['popup'] ) && $data['popup'] === false ? false : true;

		ob_start(); ?>
		<a href="<?php echo esc_url( $data['permalink'] ) ?>" class="<?php echo esc_attr( $has_popup ? 'cts-open-popup' : '' ) ?>">
			<i class="<?php echo esc_attr( $data['icon'] ) ?>" style="background-color: <?php echo esc_attr( $data['color'] ) ?>;"></i>
			<?php echo esc_html( $data['title'] ) ?>
		<?php return trim( ob_get_clean() );

	public function copy_link( $options ) {
		if ( empty( $options['permalink'] ) ) {

		$title = _x( 'Copy link', 'Share dialog', 'my-listing' );
		return sprintf(
			'<a class="c27-copy-link" href="%s" title="%s">'.
				'<i class="fa fa-clone" style="background-color:#95a5a6;"></i>'.
			esc_url( $options['permalink'] ), $title, $title

Edit the Sharer File

If you would like to add back some sharing options, edit the Mail option content, or just make some other customizations, you can compare the default sharer file (/my-listing/includes/extensions/sharer/) to the one we’ve provided for download, using your preferred text editor application, such as Visual Studio Code, Notepad++,, etc.)

When you have both files pulled up side by side in the text edit application, you can easily copy settings from the original sharer.php to your new file.

If you’re having trouble identifying the differences or just want to look at things differently, we show you how to use a “file difference checker”, in the next section.

Note: We recommend testing this out in a staging environment first, before touching your live website.

Compare the Sharer Files with a Difference Checker

You can use a “file difference checker”, such as Diffchecker, to quickly see the differences in two files, and we have created a video to show you how this works when using our preferred FTP application (FileZilla) to connect to our server and compare our two sharer.php files.

Video Tutorial

NEW: MyListing Club Community

Get a true community experience that Facebook just can't offer.

WooCommerce Subscriptions Ready

The latest version of the WooCommerce Subscriptions plugin is included (unlicensed) and once you have a Starter Site in hand, you can easily put in your own pricing, package features, graphics, etc.

Should you not wish to use WooCommerce Subscriptions, you can simply turn the Listing Subscription packages into standard MyListing packages in just a few clicks and be on your way.

  • WooCommerce Endpoint Design
  • WooCoommerce Subscriptions Setup
  • Listing Subscription Packages
  • Listing Subscription Switching
  • Stripe Payment Gateway Plugin
  •  and more…

Premium Assets

Get licensed, premium plugins, valued at over $600 in the first year alone, making a Starter Site investment a no-brainer.

You will get licensed copies of all the plugins listed below, with the exception of the WooCommerce Subscriptions and WooCommerce Product Vendors, and the licenses are yours to keep, for as long as the plugins remain on your website.

  • Elementor Pro ($49)
  • Perfmatters ($25)
  • Permalink Manager Pro ($45)
  • SEOPress Pro ($39)
  • UiPress ($39)
  • WooCommerce Product Vendors ($79) 
  • WooCommerce Subscriptions ($199)
  • WP Rocket ($49)