• Resolved edgepro

    (@edgepro)


    Is there a way to use a MPG shortcode to set the Featured Image field? I tried using the Featured Image from URL (FIFU) plugin but the MPG shortcodes do not render in the URL field on the page template. I also tried that with the Shortcode Any Widget plugin, trying to make a square bracketed shortcode [] but that also does not render. Seems like there should be a simple way to set this like how the other common page fields like the slugs, titles, etc. can be set. Any ideas on how to make this work?

    For example, on my city pages, I have URLs of the desired featured images in my media library like this:
    content/uploads/Los-Angeles-Night.jpg
    content/uploads/Bakersfield-Night.jpg
    content/uploads/Fresno-Night.jpg

    and I’m trying to make it work like this:
    content/uploads/{{mpg_city}}-Night.jpg

    In the page source, it’s rendering out like this on each city:
    content/uploads/mpg_city-Night.jpg

Viewing 1 replies (of 1 total)
  • Hi.

    No, it’s not possible, even WordPress core does not provide an appropriate hook for that.
    Sure, using str_replace or regular expression we can cut and replace needed part of html code on the page, but this is “crutch”

    But you can override an OpenGraph image, if you need.
    Just add a custom field to the template page \ post. As a name set mpg_opengraph_image_src:11, where 11 – is a project id, and as a value – shortcode with header name, that contains the link to the image.
    It should looks like this: https://joxi.ru/DmBYQJ7ignxxar

Viewing 1 replies (of 1 total)
  • The topic ‘Featured Images’ is closed to new replies.