Import from WP-Property
-
Is it possible import properties from WP-Property?
-
Thanks Steve,
Still need a bit of help. I am trying to add the address below the title on the single property page. I have tried amending the code you sent before to add to search results, although the following code doesn’t wo[rk (I’m not great with php as i’m sure you’ve noticed!)..
add_action( ‘propertyhive_after_single_property_loop_item_title’, ‘function_to_add_address’, 1 );
function function_to_add_address()
{
global $property;
echo ‘<p class=”add-t”>’. esc_html($property->get_formatted_full_address());
}
Good morning,
Try the following:
https://gist.github.com/propertyhive/24dc5de86149fad8baf82f409e3a949a
Thanks, that works great. Is there a list of hooks that Property Hive uses that I can utilise?
Only in the template at the moment. So look in the Property Hive plugin, and the ‘templates’ folder, and open content-property.php for example and you can see the hooks in there. Same for content-single-property.php.
We are rewriting our documentation at present which will include a full list of hooks.
ok – many thanks for your help
Hi Steve,
I am adding a link to the summary description box, but this is being stripped out in the front-end. Is there a way around this? If this isn’t possible, is there a way of echoing the floorplan in the summary only for sold properties?
Thanks as always for your help
Screenshots
We use the WP function get_the_excerpt() to output the summary in search results. This will strip HTML by default.
I’ve done a Google for “get_the_excerpt() allow HTML” and there are lots of discussions about this. Here’s just one I’ve found:
Thanks,
Yes, I did try this method which works fine for normal WP Posts, but not the PH excerpt. Alternatively, could we just amend the code you reviously supplied to echo the floorplan out in the summary?
add_action( ‘propertyhive_single_property_summary’, ‘function_to_add_address_to_single’, 6 ); function function_to_add_address_to_single() { global $property; echo ‘<p class=”add-t”>’. esc_html($property->get_formatted_full_address()) . ‘</p>’; }
My apologies. After looking into this further we don’t use get_the_excerpt(). We call strip_tags directly in the template:
https://github.com/propertyhive/WP-Property-Hive/blob/master/templates/search/summary.php#L19
As a result the best this would be to either:
- Override the above template into your theme and remove the strip_tags() references.
- Use a snippet like so: https://gist.github.com/propertyhive/23d99af7378a4239a43a3d0ae57b5153
- You must be logged in to reply to this topic.