php - Facebook OG Image If, or, or, else statement -


I have 3 sources in which users can contribute either an Instagram URL, an image URL or an image upload with. Users can contribute only to use 1 of 1 in 1.

I am trying to help the Facebook OpenGraph remove from the project source / image URL / image upload either from the image. The embedded instagram image, I already have a custom field, but the image URL is not however and if any of these 3 is not provided by the user, the site icon will be turned on.

I know how to include image uploads, but I'm not sure how should I include the instagram image (custom fielded) and image url, can someone help me?

I have this code:

  add_action ('wp_head', 'add_fb_open_graph_tags'); Function add_fb_open_graph_tags () {if (is_single ()) {global $ post; If (get_the_post_thumbnail ($ post-> ID, 'thumbnail')) {$ thumbnail_id = get_post_thumbnail_id ($ post-> ID); $ thumbnail_object = get_post ($ thumbnail_id); $ Image = $ thumbnail_object- & gt; Guid; } Other {$ image = 'http://my-site.com/wp-content/themes/something/images/icon.jpg'; // Change it to the URL of the logo next to your link shown on Facebook}? & Gt; & Lt; Meta Property = "OG: Title" content = "& lt ;? php the_title () ;? & gt;" / & Gt; & Lt; Meta Property = "OG: Type" content = "Article" /> & Lt; Meta Property = "OG: Image" content = "& lt ;? php echo $ image;; & gt;" / & Gt; & Lt; Meta Property = "ogg: url" content = "& lt ;? php the_ paramchink () ;? & gt;" / & Gt; & Lt; Meta Property = "OG: Details" content = "   

More: Image Allow Tags to mark tags for your markup to select any additional images you want to use:

   
Meta attribute = "OG: image" content = "http://example.com/rock2.jpg "/>

Try adding an instagram image and uploaded image like this

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -