I’ve successfully added a custom field to the media upload dialog, but now I need (1) this field to be present on the
<img> tag on post content whenever an image is inserted, and (2) a way to edit this on TinyMCE.
Currently it outputs the following shortcode:
<img class="size-thumbnail wp-image-277" src="http://localhost/wp-content/uploads/2019/01/filename-150x150.png" alt="ALT" width="150" height="150" />CAPTION
Which then is converted into
<figure id="attachment_277" style="width: 150px" class="wp-caption alignnone"> <img class="size-thumbnail wp-image-277" src="http://localhost/wp-content/uploads/2019/01/filename-150x150.png" alt="ALT" width="150" height="150" srcset="http://localhost/wp-content/uploads/2019/01/filename-150x150.png 150w, http://localhost/wp-content/uploads/2019/01/filename-100x100.png 100w" sizes="(max-width: 150px) 100vw, 150px" /> <figcaption class="wp-caption-text">CAPTION</figcaption></figure>
However, I need it to be
<figure class="someclass"> <img class="otherclass" srcset="..." src="..." width="800" height="600" alt="ALT"> <figcaption class="legend">CAPTION — $field</figcaption> </figure>
How can I change it?
I also need a way for the field to be shown not only on the media library dialog, but also on TinyMCE’s image edit dialog.
How can I achieve that?
- Facebook’s Silent Autoplay Video Ads Require Custom Content To Shine
- 2019 QVC Customer Choice Beauty Awards: 17 Must-Have Products
- Facebook ads a ‘sophisticated’ threat to elections ―US Senator
- The electric hypercar with a £2.5m price tag: Aspark Owl is unveiled at Dubai motor show and can reach 60mph in 1.69 seconds (but would run out of juice after 69 minutes at top speed)
- Rootstock Software® Debuts ERP Connector to Salesforce Field Service Lightning
- The jasmine with a GI tag
- Buttigieg releases ad in Iowa highlighting health care plan
- Is YOUR doorbell spying on you? Amazon's Ring let employees watch live footage from customers' cameras, report claims
- 'A real deal': Ad handwritten by Steve Jobs offering a circuit board and manual for Apple's first computer for $75 set for auction
- Ogun Customs arrests notorious smuggler, secures conviction of 3 vandals