php – Select Image from Media Library and insert into page with responsive markup


I’m building a site for my friend which uses a custom theme and no page builder. The home page has 4 splash images, and to make things as simple as possible for him I’m trying to create some functionality in the backend which will allow him to choose an image from the media library for each of the 4 locations, click save and have them displayed on the front end.

I’ve built a custom page in the admin area but am struggling with the rest. How do I:

  1. Add 4 simple “choose media” buttons that will allow him to pick an image from the media library for each location

  2. Save these choices in the db

  3. Recall this from the db and display them in the front end with the default responsive wordpress markup (srcset attribute)?

I’ve been googling for hours and the closest I’ve come to a solution was this tutorial, but it’s out of date.

Thank you in advance!

Matt 2 years 2021-03-23T21:00:52-05:00 0 Answers 0 views 0

Leave an answer