[resolved] Adding fallback description and image to OG meta info (3 posts)

  1. specialmachine
    Posted 3 years ago #

    I see that the fallback image question is answered here...


    But how do I combine a fallback description with a fallback image? I don't understand PHP well enough to hack it together myself. Any help is much appreciado.


  2. Niall Kennedy
    Plugin Author

    Posted 3 years ago #

    The plugin builds a set of defaults for the currently loading WordPress page. The page might be your website's homepage, an author page, or an individual post.

    You can act on multiple properties of the page such as title and description. The example adds a new image. To add a description where none exists you might add code similar to the following:

    if ( ! isset( $meta_tags['http://ogp.me/ns#description'] ) )
    	$meta_tags['http://ogp.me/ns#description'] = 'You will want to read this';

    A full list of Open Graph protocol properties is available at ogp.me.

  3. specialmachine
    Posted 3 years ago #

    Yeah, this is for "pages" that have post text or excerpt. And then there are posts that have no images, which is on purpose, like here...


    So combining the above that you've posted and the earlier example I posted will hopefully be painless. I suppose a bit of hacking never hurt anyone. I'll have to see what I can do. Thank you so much! And if you have any friends in London, send them right along to our get together on the 18th. :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Facebook
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic