I've just started to create my own wordpress themes. Now i'm struggeling with the ability to select from different images and apply them to that specific container.
Here's a quick ASCII-sketch:
Nav-div Display-div
-------------- -------------
| | | |
| >>Link1<< | | Image for | <-- Lets say link1 has class="customer"
| Link2 | | Link1 | <-- Owner choses what image should be displayed-
| Link3 | | | in that container.
| | | |
| | | |
| | | |
-------------- --------------
As of now, I'm using the WP function get_header()
but as the name suggests, it only fills the container with the header
image the user has selected.
How would I create a "get_header
-function" while also connecting it to a specific class-tag? Is there anything like this available out there already? If not, what would be your best approach to this problem?
TL;DR:
How would one create a function that adds the ability to select images from the WP gallery and display them in a desired container in the same way as the get_header()
function does.
Images for clarification:
You can use Meta Box plugin to add a gallery field to your backend.
Here you can find the different type of fields that this plugin allows you to add. It is free.
Then if you want to show the image, you can retrieve every image source with php and put in where you want, as an image or a background of a specific container.
In the Meta Box Documentation you'll find all the info how to display images or a gallery of images.