Inventory_Presser_Email_A_Friend::url( WP_Post $post )

Creates a mailto: url to draft an email containing vehicle information.


Parameters Parameters

$post

(WP_Post) (Required) A vehicle post object.


Top ↑

Return Return

(string)


Top ↑

Source Source

File: includes/class-menu-item-email-a-friend.php

	public function url( $post ) {

		if ( ! isset( $post->post_title ) ) {
			return '';
		}

		$subject = 'Check out this ' . $post->post_title;
		$body    = sprintf(
			'Please look at this %s for sale at %s:

%s',
			$post->post_title,
			html_entity_decode( get_bloginfo(), ENT_QUOTES ), // WordPress encodes quotes in site names
			get_permalink( $post )
		);
		return sprintf(
			'mailto:?subject=%s&body=%s',
			rawurlencode( htmlspecialchars_decode( $subject ) ),
			rawurlencode( htmlspecialchars_decode( $body ) )
		);
	}