P.S. Hi Admin, I tried looking for the solution but could not see the same issue anywhere!
Hi all,
I have a child theme. I have a function which is wrapped in if !function_exists as below. The file in is includes folder. The function is in wp-content/themes/themename/includes/alias-function.php
if (!function_exists('jem_render_buy_fee ')) {
function jem_render_buy_fee() {
$fee=(ea_get_option('order_commission_buyer'))?ea_get_option('order_commission_buyer'):'';
if($fee){
?>
<div class="jem-commission-fee">
<span><?php _e($fee.'% commission fee included', 'themes'); ?></span>
</div>
<?php
}
}
}
Because it is in includes folders but wrapped in function_exists, so I declare the function in functions.php as below. This file is in wp-content/themes/themename-child/functions.php
function jem_render_buy_fee() {
$fee=(ea_get_option('order_commission_buyer'))?ea_get_option('order_commission_buyer'):'';
if($fee){
?>
<div class="jem-commission-fee">
<span><?php _e($fee.'% GST inclusive', 'themes'); ?></span>
</div>
<?php
}
}
I am getting the error:
Your PHP code changes were rolled back due to an error on line 1873 of file wp-content/themes/themename/includes/alias-function.php. Please fix and try saving again.
Cannot redeclare jem_render_buy_fee() (previously declared in wp-content/themes/themename-child/functions.php:215)
Why am I getting this? The error is wrapped in function_exist.
I can see its loading the function.php, but then it should ignore the existing one in the file.
Thank you in advance.