Hello, I appreciate your question and understand your concern.
Certainly! If you want to increase automatically shipments handled count with 80 its happen using code:
Add the following code to your theme’s functions.php file or create a custom plugin:
// Schedule an event to run daily
function schedule_shipments_counter_event() {
if (!wp_next_scheduled('update_shipments_counter')) {
wp_schedule_event(time(), 'daily', 'update_shipments_counter');
}
}
add_action('wp', 'schedule_shipments_counter_event');
// Hook for the scheduled event
function update_shipments_counter_event() {
// Get the current value from the database
$current_count = get_option('shipments_counter', 0);
// Increment the value by 80
$new_count = $current_count + 80;
// Update the value in the database
update_option('shipments_counter', $new_count);
}
add_action('update_shipments_counter', 'update_shipments_counter_event');
// Shortcode to display the shipments counter
function shipments_counter_shortcode() {
// Get the current value from the database
$current_count = get_option('shipments_counter', 0);
// Return the current count for display
return $current_count;
}
add_shortcode('shipments_counter', 'shipments_counter_shortcode');
- Now, in your Elementor page, you can use the Shortcode Widget to display the shipments counter. Add a Shortcode Widget where you want the shipments counter to appear and enter the shortcode
[shipments_counter].
With this setup, the shipments counter will automatically increase by 80 every day, and the updated value will be displayed wherever you use the [shipments_counter] shortcode. Please note that the counter updates when someone visits your site, so it may not be precise to the exact time every day, depending on your site’s traffic.
Hope you find your answer. Thank you
Hey @narolainfotech,
just found this, and have to say thank you – this is very useful!
Could you help me just a little bit (i´m no coding pro) – i want to display a different start number and a different value for increase the number (+ 25 every day). I tried to edit your code, but it keeps stuck at 80.
Can you help me please?
Best Regards,
Moritz
The “Startnumber” schould not be “0”, should be “15.012”
I just replaced 80 with 25 and the $current_count “0” with my starting number (15012) but it didnt work
Oh sorry – i think it was a cache problem only – i tested on another website and now the new start number is displayed. But at the website i first implemented with “80” an “0” (start) – it still displays the 80….i dont know why and resetted all cache/data