Newspaper RC12.3 – woo shortcode bug

Posted in: Newspaper
Post count: 99

Hello,

I’ve just updated to RC12.3 and I get an error message (call to undefined function add_shortcode()) with this function I added to the functions.php file in order to list woocommerce orders :


function woo_order_history( $atts ) {
extract( shortcode_atts( array(
'order_count' => -1
), $atts ) );

ob_start();
$customer_orders = wc_get_orders( apply_filters( 'woocommerce_my_account_my_orders_query', array(
'customer' => get_current_user_id(),
'page' => $current_page,
'paginate' => true,
) ) );
wc_get_template(
'myaccount/orders.php',
array(
'current_page' => absint( $current_page ),
'customer_orders' => $customer_orders,
'has_orders' => 0 < $customer_orders->total,
)
);
return ob_get_clean();
}
add_shortcode('woocommerce_history', 'woo_order_history');

I never got any error message with the previous theme versions.

Here’s the exact error message from the log :

PHP Fatal error: Uncaught Error: Call to undefined function add_shortcode() in .../wp-includes/functions.php:8471

Post count: 99

Thanks for your help.

Regards.

Post count: 53

Where can we check the changelogs of Newspaper RC versions? I will definitely help you to improve the beta version, used by the users ?

Post count: 27744

Hello,


@Lalit
The RC version is for testing the recurring stripe payment because a problem has been reported.

@sco
Did you add that code in functions.php file? Usually, you can find your orders in Woocommerce -> Orders https://i.imgur.com/2tFVIQS.png, without any code. Please check if you remove the code if the error is still displayed.

Thank you!

Post count: 99

Hi,

Please re-read my message as you’ll find the answer to your question.

1. I need this code to add orders history elsewhere
2. I had no problem before updating to version RC12.3, the code was working fine
3. Yes, the code is pasted at the end of the functions file.

There is something linked to the update (RC12.3) that prevents this code to work properly and that generates the error message about the add_shortcode function.

This is what my question was about.

Regards.

Post count: 27744

A new option for a smarted product will be added in the new update and compatibility with WPML , but I don’t know if this caused this error.
I will test on my end; until then please use version 12.2

Thank you!

Post count: 27744

Hello @sco,

Please provide the wp-admin access and cpanel access to investigate this error.
Send those details to contact@tagdiv.com

Thank you!

Viewing 7 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic.