Created
May 23, 2025 08:59
-
-
Save propertyhive/f0fb3d4eb0a6b504ed42cf7d5192c6cd to your computer and use it in GitHub Desktop.
Shortcode to output property owners
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_shortcode('property_address', 'property_owners'); | |
function property_owners() | |
{ | |
global $property; | |
if ( !isset($property->id) ) { | |
return; | |
} | |
ob_start(); | |
$owner_contact_ids = get_post_meta(($property->id, '_owner_contact_id', TRUE); | |
if ( !empty($owner_contact_ids) ) | |
{ | |
foreach ( $owner_contact_ids as $owner_contact_id ) | |
{ | |
$contact = new PH_Contact($owner_contact_id); | |
echo '<p>'; | |
echo 'Name: ' . get_the_title($owner_contact_id) . '<br>'; | |
echo 'Tel: ' . $contact->telephone_number . '<br>'; | |
echo 'Email: ' . $contact->email_address; | |
echo '</p>'; | |
} | |
} | |
return ob_get_clean(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment