Tell us what you are trying to do?
My site was recently migrated to a new server running PHP 8.0 and I'm getting an error on only certain pages that utilize this function. This only occurs on a few pages, most others seem to operate okay. When I comment this out, page loads (without the currency being added). I'm hoping you can help.
Function:
//This formats number to currency format
function format_my_number($atts)
{
$atts = shortcode_atts(
array(
'num' => '',
'sym' => '',
),
$atts
);
$num = $atts['num'];
return $atts['sym'].''.number_format($num, 0, '.', ',');
}
add_shortcode('format-currency', 'format_my_number');
Error message:
#0 /home/nk21itv2x7ao/public_html/wp-content/themes/total-child-theme/functions.php(327): number_format('', 0, '.', ',')
#1 /home/nk21itv2x7ao/public_html/wp-includes/shortcodes.php(433): format_my_number(Array, '', 'format-currency')
#2 [internal function]: do_shortcode_tag(Array)
#3 /home/nk21itv2x7ao/public_html/wp-includes/shortcodes.php(273): preg_replace_callback('/\\[(\\[?)(format...', 'do_shortcode_ta...', '
Is there any documentation that you are following?
No
Link where error occurs:
hidden link
When loops are placed individually by community, the show up without issue. But the "Search" function is not present.
hidden link