Reputation: 144
My posts require a user to input their height in the following format 0'0". This is a custom meta value.
I need to add an additional custom field that adds the height in inches.
If the user ever changed the height, this would need to also update the height in inches.
Does something need adding to functions.php? Not too sure how to do this.
Many thanks Lewis
Upvotes: 0
Views: 52
Reputation: 917
Following steps can be followed :
1) On save_post hook you can calculate height in inches and update the post meta table. (Need to code in functions.php)
2) Create a custom meta value for height in inches. (entry in post meta table)
save_post Runs whenever a post or page is created or updated, which could be from an import, post/page edit form, xmlrpc, or post by email. Action function arguments: post ID and post object.
Reference: http://codex.wordpress.org/Plugin_API/Action_Reference/save_post
Upvotes: 3