I have created a custom Meta Box that appears on my WP post edit screen. I would like this box to be an image preview of sorts, the URL for the image should be controlled by another field on the post edit screen.

For example:

  • I have a select field with a range of values from 5 - 10.
  • I have a number of images with following urls: 'example-5.jpg' to 'example-10.jpg'
  • In my custom meta box I have an image with src of '/img/example-'$val'.jpg'

So, as a user selects the value from custom field the image within custom meta box will appear.

Can anyone provide some guidance on creating something like this? Im guess I will need to use JS for the realtime rendering of the image but not sure how to actually get the value from the custom field..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.