I have been asked to create a dial on a wordpress website. The customer wants to be able to update the value of the gauge.
I have two options – I can either create something that sits alongside wordpress where they can update the value, or I can have it as part of wordpress, but I am not sure how to do that or how easy it would be.
Basically I just need a screen where an authenticated user can update a value. I then need to be able to read that value from one of the theme files (specifically the static front page theme file) and display it.
I am comfortable with PHP, but not familiar with wordpress – is there any easy way to do this, or will it make more sense to just do it separately?
It should be pretty easy actually – WordPress provides the core of what you need to interact with the database.
Here’s some sample code of a theme I built a few years back. There’s more to it than this, obviously you have to create the table at some point. But once that is in place, the global $wpdb is your gateway.
Alternatively for just a one field, you could use the “options”. e.g.
update_option()is/was in /wp-includes/function.php (I presume it’s still there… it’s been a while) and you would need to call anadd_optionbefore hand –get_option()will return the current value.