Skip to content

Instantly share code, notes, and snippets.

@jonschr
Created June 30, 2023 19:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonschr/c6c602c3341e7247068822b3ea1839bd to your computer and use it in GitHub Desktop.
Save jonschr/c6c602c3341e7247068822b3ea1839bd to your computer and use it in GitHub Desktop.
<?php
remove_action( 'rentfetch_do_single_properties', 'rentfetch_single_property_basic_info', 30 );
add_action( 'rentfetch_do_single_properties', 'bankier_single_property_basic_info', 30 );
function bankier_single_property_basic_info() {
// bail if this section isn't set to display
$single_property_components = get_field( 'single_property_components', 'option' );
if ( $single_property_components['enable_basic_info_display'] === false )
return;
global $post;
$id = esc_attr( get_the_ID() );
$address = esc_attr( get_post_meta( $id, 'address', true ) );
$city = esc_attr( get_post_meta( $id, 'city', true ) );
$state = esc_attr( get_post_meta( $id, 'state', true ) );
$zipcode = esc_attr( get_post_meta( $id, 'zipcode', true ) );
$url = esc_url( get_post_meta( $id, 'url', true ) );
$phone = esc_attr( get_post_meta( $id, 'phone', true ) );
echo '<div class="wrap-basic-info single-properties-section"><div class="basic-info single-properties-section-wrap">';
if ( $address || $city || $state || $zipcode ) {
echo '<div class="location">';
echo '<p class="the-location">';
if ( $address )
printf( '<span class="address">%s</span>', $address );
if ( $city )
printf( '<span class="city">%s</span>', $city );
if ( $state )
printf( '<span class="state">%s</span>', $state );
if ( $zipcode )
printf( '<span class="zipcode">%s</span>', $zipcode );
echo '</p>';
echo '</div>';
}
if ( $phone ) {
echo '<div class="call">';
echo '<p class="the-call">';
printf( '<span class="calltoday">Call today</span>' );
printf( '<span class="phone">%s</span>', $phone );
echo '</p>';
echo '</div>';
}
if ( $url ) {
// prepare the property url
$url = apply_filters( 'rentfetch_filter_property_url', $url );
echo '<div class="property-website">';
printf( '<a class="button property-link" target="_blank" href="%s">Apply now</a>', $url );
echo '</div>';
}
echo '</div></div>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment