I want to add custom field, named score, for each post individually and store it in database so I can later order posts by that field. I need to make it available on post edit to change this value, so it would basically be an input text field which accept numbers 0 to 5. To do this, do I have to create custom post type, or is there a way to achieve it with ordinary posts section?
The easiest approach would be to use the Advanced Custom Fields plugin.
A quick example for your situation (this example assumes you have access to your theme files, and can update the PHP for output of the 'Scores' field):
- Install and activate the plugin
- Navigate to Custom Fields in the left-hand nav
- Create a new Field Group
- Create a 'Scores' text field
- Output the 'Scores' field in your page/post
WP_Queryto load and sort the posts by your new 'Score' field