rep__get_display_price()

This function, is used to retrieve the display price of a listing based on the provided post ID.

Namespace

REP_Malcolm

Parameters

$post_id

int

Post ID of the listing

Return

string

Display price

Source

File: \includes\rep-helper-functions.php

function rep__get_display_price( $post_id ){

    $display_price = "";

    $states = rep__get_listing_status( $post_id );

    if( in_array( "Sold", $states ) || in_array( "Leased", $states ) ){
        $hide_price = lp__get_field_value( 'state_hide_price', $post_id );

        if( !$hide_price ){
            $display_price = lp__get_field_value( 'state_value_price_display', $post_id );
        }
    } else {
        $display_price = lp__get_field_value( 'price_advertise_as', $post_id );
    }

    if( ! $display_price ) $display_price = "Contact Agent";

    return $display_price;

}