One option would be to set up a shortcode. You can add this either in your theme’s functions.php, or as a plugin:
add_shortcode('varnumber', 'my_var_number');
function my_var_number($atts, $content = null) {
return 'Put whatever number you want here instead of this text';
}
Wherever you want the number to appear, use the shortcode [varnumber]
in the content. Whenever you need to change the number you’ll be able to change it in just one location (your theme or plugin, whichever you chose).
You could go a step farther and set the number in the database if you want. Perhaps set up a wp-admin dashboard widget where you save the number, and then adjust the my_var_number
function to pull it from the database instead of your theme or plugin.
Updated per comments: yes, you can have a shortcode within a shortcode. The outer shortcode needs to use do_shortcode($content)
in order for this to work. I don’t know what your initial outer shortcode looks like, but hopefully this will illustrate what needs to be present:
add_shortcode('outershortcode', 'create_outer_shortcode');
function create_outer_shortcode($atts, $content = null) {
$before="<div class="outershortcode">";
$after="</div>";
return $before . do_shortcode($content) . $after;
}
Your shortcode will be different, but wherever you see $content
just make sure it’s wrapped in do_shortcode()
so it will process the shortcode inside when you call it like this:
[outershortcode][varnumber][/outershortcode]