Include the Contact Details in the Search Results

The 2.2 update made it possible to make the contact details automatically show up in the search results by enabling the ‘Always show the contact details below the address in the search results?’ option in the User Experience section on the WPSL Settings page.

If you would like to include contact details in the search results, you can do this with the wpsl_listing_template filter.

In this example, data from the phone, fax, and email fields are included in the listing template between line 20 and 30:

Place this code in the functions.php in your theme folder, reload the page, and you should see the contact details in the search results.

Contact details

Make the Email Address and Phone Number Clickable

The above code example shows the email address and phone number without any links attached to them. You can easily change this by making a small modification to the code.

Email
Replace the <%= email %> ( line 28 ) with the following code:

Phone Number
Replace the <%= formatPhoneNumber( phone ) %> ( line 22 ) with the following code: