@withacause That code is still working for me if I replace the property_details_shortcode()
function in the AgentPress Listings plugin.
Or you can use this version in your theme’s functions.php
:
add_shortcode( 'property_details_new', 'property_details_shortcode' );
function property_details_shortcode( $atts ) {
global $post, $_agentpress_listings;
$output = '';
$output .= '<div class="property-details">';
$output .= '<div class="property-details-col1">';
foreach ( (array) $_agentpress_listings->property_details['col1'] as $label => $key ) {
$value = get_post_meta($post->ID, $key, true);
if ( !empty( $value ) ) {
$output .= sprintf( '<b>%s</b> %s<br />', esc_html( $label ), esc_html( get_post_meta($post->ID, $key, true) ) );
}
}
$output .= '</div><div class="property-details-col2">';
foreach ( (array) $_agentpress_listings->property_details['col2'] as $label => $key ) {
$value = get_post_meta($post->ID, $key, true);
if ( !empty( $value ) ) {
$output .= sprintf( '<b>%s</b> %s<br />', esc_html( $label ), esc_html( get_post_meta($post->ID, $key, true) ) );
}
}
$output .= '</div><div class="clear">';
$output .= sprintf( '<p><b>%s</b><br /> %s</p></div>', __( 'Additional Features:', 'apl' ), get_the_term_list( $post->ID, 'features', '', ', ', '' ) );
$output .= '</div>';
return $output;
}
You will then need to use [property_details_new]
for your shortcode instead of [property_details]
.