But how can I also resolve the “url” of the “poster” attribute?
I would like to be able to insert a new “Add Customizer Control” and a new “Theme Mod To Attr” but it is not possible, so I assume that I can only change one attribute.
Am I doing something wrong?
This is a problem! Anyone have any idea how to fix this and can help me?
Hi @superfabiuz,
Sorry for the delay in answering - I had to work it out for myself first!
So to accomplish this you will need two customizer controls. I’m going off of the original HTML you first posted.
The first customizer control to change the source src is what you have already worked out. So this should be applied to the source element.
The second customizer control should be added to the video element. In this case, you add the normal customizer control action. Select a control type of media and a mime type of image.
This will return the id of the media which has to be converted to the url.
NOTE: I used an id of link_poster_preview, change this to what you would like both in the control and custom PHP.
To convert the id to a URL and add in to the video element we will add a PHP code action block. Within the PHP code action block, replace the “Attribute” with an attribute name of poster. Click on the “Get image url from id” checkbox. Then for the function add: