Created
July 27, 2016 17:24
-
-
Save GeoffEW/69f8a033fb614c78b3de45a197431135 to your computer and use it in GitHub Desktop.
/* Force the use of the cost field of event and ignore tickets price */
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Force the use of the cost field of event and ignore tickets price */ | |
function tribe_just_show_price_field ( $cost, $post_id, $with_currency_symbol ) { | |
$cost_utils = Tribe__Events__Cost_Utils::instance(); | |
$cost = tribe_get_event_meta( $post_id, '_EventCost' ); | |
if ( $with_currency_symbol ) { | |
$cost = $cost_utils->maybe_format_with_currency( $cost ); | |
} | |
return $cost; | |
} | |
add_filter( 'tribe_get_cost', 'tribe_just_show_price_field', 10 , 3 ); | |
/* activate event cost field when using event tickets */ | |
add_filter( 'tribe_events_admin_show_cost_field', '__return_true', 100 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great job, this still works better than the official extension!
https://theeventscalendar.com/extensions/show-cost-field/