Problem:
The code to add commas to the numbers to separate the thousands shows 0 when the result of the custom field is empty.
Solution:
Change the code to this:
add_shortcode( 'ts_format_number', 'ts_format_number_func');
function ts_format_number_func( $atts, $content ) {
$int = (int) do_shortcode($content);
if ($int == null) {
return "";
} else {
return number_format($int, 0);
}
}
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
Dieses Thema enthält 2 Antworten, hat 2 Stimmen.
Zuletzt aktualisiert von vor 4 years, 4 months.
Assistiert von: Christopher Amirian.