Skip to content

Instantly share code, notes, and snippets.

@JoeHana
Created August 8, 2013 00:28
Show Gist options
  • Save JoeHana/6180318 to your computer and use it in GitHub Desktop.
Save JoeHana/6180318 to your computer and use it in GitHub Desktop.
Replace price with custom field
<?php
/**
* Replace price with custom field
*/
add_filter( 'ts_currency_price', 'custom_property_price' );
function custom_property_price( $price ) {
$post_id = get_the_ID();
// Get text before price
$price_label = get_post_meta( $post_id, 'price_label', true );
if( $price_label )
return $price_label;
return $price;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment