Inventory_Presser_Email_A_Friend::url( WP_Post $post )
Creates a mailto: url to draft an email containing vehicle information.
On This Page
Parameters Parameters
- $post
-
(WP_Post) (Required) A vehicle post object.
Return Return
(string)
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 ) )
);
}
Expand full source codeCollapse full source codeView on Github