dunham.scott
Forum Replies Created
Viewing 1 replies (of 1 total)
-
Forum: Plugins
In reply to: [The Events Calendar] Text string for multiple prices not workingSounds like there are good points on both sides of this, so hopefully things will get worked out eventually. But for the mean-time, I’m not really a big fan of the two fixes suggested above since they involve a lot of overriding of templates and/or core event calendar functions. Luckily there’s a filter available in the
tribe_get_costfunction, so I elected to use that instead://Display full event cost string if meta field contains non-currency characters add_filter('tribe_get_cost', 'my_full_text_cost_fix', 10, 2); function my_full_text_cost_fix($cost, $post_id){ if(tribe_is_list_view() || tribe_is_month() || tribe_is_week() || tribe_is_day() || is_single()){ $strRealCostValue = tribe_get_event_meta( $post_id, '_EventCost', true ); //Check if cost meta value is a currency string $blnIsCurrencyString = preg_match('/^[0-9]+(?:\.[0-9]{2}){0,1}$/', $strRealCostValue); //If cost contains non-currency characters, return the full string instead of the formatted value if(!$blnIsCurrencyString){ $cost = $strRealCostValue; } } return $cost; }Adding this code to functions.php will display the full cost string if it’s not formatted as currency (i.e. “10.50”).
Viewing 1 replies (of 1 total)