JoeHana
7/7/2013 - 11:39 PM

Add ‘text’ after price, only if status is not sold (visible for both, rent and sale)

Add ‘text’ after price, only if status is not sold (visible for both, rent and sale)

<?php

/**
 * Add ‘text’ after price, only if status is not sold (visible for both, rent and sale)
 */
add_filter( 'wpcasa_property_price', 'custom_property_price_from' );

function custom_property_price_from( $price ) {

  $arg1 = get_post_meta(get_the_ID(), '_price', true);
  $arg2 = get_post_meta(get_the_ID(), '_price_sold_rented', true );
  $arg3 = get_post_meta(get_the_ID(), '_price_status', true );

  if(!empty($arg1) && $arg2 != '1') {
    if($arg3 == 'rent') {
      $output = $price . ' <small>zzgl. Kauf-Nk.</small> ';
    } else {
      $output = $price . ' <small>zzgl. Kauf-Nk.</small> ';    
    }
  } else {
    $output = $price;
  }

  return $output;

}