The test will confirm the problem is PHP 8 and then we will try to check if there is something with the custom function code.
I just setup a very basic website. I created 3 custom fields - Brand, Model, and Price. I added 3 Pianos using the 3 fields. Then created a VIEW at:
hidden link
You can see the function works and produces the desired output. Price: $ 11,999.00
I added the following function to the functions.php at the end of the file.
/*The Convert to Currency function */
function format_money( $atts ) {
extract( shortcode_atts( array(
'price' => '0'), $atts) );
return $price = number_format($price, 2);
}
add_shortcode('format_money', 'format_money');
Now if this were PHP 8.0.30 will it still work???
Hi there,
I moved the website to another server with PHP 8.1 and it works there too:
hidden link
You can login here:
hidden link
Thanks.
Hi Christopher,
I believe my problem is solved. A problem is with the value being NULL in the price field on some of the product. I added a 4th piano with no price value in the test site and it crashed the page. In the Live site the Zero Values did not affect it. My guess is the later version of PHP had a problem with a zero value. My solution is to place a conditional if 0 or less than 1 on price.
Christopher, Thank you for all your help in narrowing down what was happening.