WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. specialmachine
    Member
    Posted 1 year ago #

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

    http://wordpress.org/support/topic/customize-open-graph-protocol-for-your-site-or-network

    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.

    http://wordpress.org/extend/plugins/facebook/

  2. Niall Kennedy
    Member
    Plugin Author

    Posted 1 year 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
    Member
    Posted 1 year 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...

    http://turtleneckclub.com/2013/03/why-do-you-say-life-was-never-meant-to-be-cheap/

    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

About this Topic