How can I add a set of custom image inputs to wordpress posts via my theme installer?
My custom Word开发者_如何学CPress theme loads 4 images from the uploads directory to the top of the page. However, its always the same 4. I want to give the user the option to specify 4 custom images for each post they create (which would override my default 4).
I'm just not certain how to add the input fields to the post editor so that they show up each time the user edits a post. I suspect I can add these hooks on theme activation, but not sure what the commands to send to wordpress would be.
Also, it would be nice to have an upload button beside each of the 4 image fields to allow the user to transfer each of the files up to the uploads directory (vs having to provide a path to the image address).
Any ideas?
You could achieve this using meta boxes, see documentation here. Then you will use get_post_meta()
to retrieve the value on each page.
精彩评论