• Resolved danielgm

    (@danielgm)


    Few weeks ago Facebook no longer allows uploading new images to link posts. Only image specified in og:image can be used. Now very important ability to specify multiple og_image. How to do it with this plugin? $fb_image should be array I think and fallbacks to featured image, default image only when array empty?

Viewing 8 replies - 1 through 8 (of 8 total)
  • You can use the fb_og_image_additional filter to add as many images as you want and you can also use the fb_og_image to apply any logic you want to the fallback images (in order to use or not the featured or default image).

    For now we think this is an advanced use scenario and should not be a GUI option on the plugin because it will render things more complicated to set up.

    Thread Starter danielgm

    (@danielgm)

    Is there any sample code for using fb_og_image_additional? I thought it was only meant for image overlays. Can alternative og_images be used together with overlay branding?

    Personally, I think that having multiple images to choose from when posting links on Facebook is more important than being able to have separate excerpts and og:descriptions, which you just added to the GUI.

    Thread Starter danielgm

    (@danielgm)

    So I used the following code:

    
    add_filter( 'fb_og_image_additional', 'extra_preview_images' );
    
    function extra_preview_images() {
            $fb_image_additional = array(
                'https://domain.com/wp-content/uploads/og_image2.jpg',
                'https://domain.com/wp-content/uploads/og_image3.jpg'
            );
            return $fb_image_additional;
    }
    

    But somehow this outputs only the first letter of each new image url:

    
    <meta property="og:image" content="h"/>
    <meta property="og:image" content="h"/>
    

    @danielgm Let me check it

    You must return a multidimensional array with the image on ‘fb_image’ and true/false on ‘png_overlay’ if you want (or not) use the overlay functionality.

    add_filter( 'fb_og_image_additional', 'extra_preview_images' );
    
    function extra_preview_images( $fb_image_additional ) {
    	$fb_image_additional = array(
    		array(
    			'fb_image' => 'https://domain.com/wp-content/uploads/og_image2.jpg',
    			'png_overlay' => true,
    		),
    		array(
    			'fb_image' => 'https://domain.com/wp-content/uploads/og_image3.jpg',
    			'png_overlay' => false,
    		),
    	);
    	return $fb_image_additional;
    }

    I’m sorry that this is not documented on the FAQs.

    Is this fixed for you @danielgm ?

    Thread Starter danielgm

    (@danielgm)

    Yes, it works. Thank you very much!

    If the overlay function is activated and an overlay image uploaded through the plugin, all fb_images will be watermarked unless png_overlay argument is supplied as false or how does it work? What happens if I don’t supply png_overlay for each fb_image_additional?

    How can I trigger the plugin’s Facebook cache reset function after adding items to fb_image_additional?

    If the overlay function is activated and an overlay image uploaded through the plugin, all fb_images will be watermarked unless png_overlay argument is supplied as false or how does it work?

    Exactly.

    What happens if I don’t supply png_overlay for each fb_image_additional?

    The plugin expects it to be there and to be true or false. If you don’t provide it, it will be the same as false, but a php notice is thrown. (will fix that in a future version)

    How can I trigger the plugin’s Facebook cache reset function after adding items to fb_image_additional?

    Only by saving the post on wp-admin or doing it manually on the Facebook Debugger.

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘So important… multiple og_image support’ is closed to new replies.