Adding fields to topics/posts
There is no way to do this in core. Are you trying to make a plugin to do this?
For adding fields to a post/topic you would use the hooks as so:
Sorting is another matter, you need to also add the fields to a sortedSet in the db, here are two examples: