How can I add a second Open Graph image to a site using Yoast?

Through the Yoast SEO plugin, I've added a 1200 by 630 image for use by sites like Facebook and LinkedIn (and the image shows up with a complete set of og meta tags).

I want to add a second open graph image (a square one) for use by WhatsApp (WhatsApp selects the last image and crops it to a 1 by 1.3 portrait aspect ratio and then displays it at 80 by 104 pixels, which doesn't work well with the image layout that works well with Facebook (and LinkedIn).

I don't think Yoast directly supports a second image, but is there a way using functions.php to add a second image (with the op:image, og:image:secure_url, og:image:height, og:image:width, and og:image:alt meta fields)? I wouldn't need the image data to be done programmatically, as I would use the same image for every page, so the information could be hard coded into functions.php.

Thanks for the help.

I've reposted the question at Stackoverflow for help with the PHP code.

Topic plugin-wp-seo-yoast open-graph Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.