WordPress.org

Ready to get started?Download WordPress

Forums

WP Facebook Open Graph protocol
[resolved] Double titles/description on Google+ (3 posts)

  1. sdaveCL
    Member
    Posted 2 years ago #

    I initially added the Open Graph plugin to fix sharing on Facebook, because Facebook was ignoring the Featured Images chosen in WordPress (no og:image tag in the header). It worked great for that.

    I am having a problem with sharing on Google+ though.

    I have Yoast's WordPress SEO plugin installed which already places some Open Graph tags to the header. WP Facebook Open Graph adds those yet again.

    So, whenever I try to share a link from my website on Google+ is shows the title and description twice. Facebook ignores the duplicates, but Google+ adds them inline.

    Is there any way to prevent this plugin from placing duplicate og:title and og:description tags in the title?

    Thanks.

    http://wordpress.org/extend/plugins/wp-facebook-open-graph-protocol/

  2. sdaveCL
    Member
    Posted 2 years ago #

    // do title stuff
    		if (is_home() || is_front_page() ) {
    			$wpfbogp_title = get_bloginfo( 'name' );
    		} else {
    			$wpfbogp_title = get_the_title();
    		}
    		echo '<meta property="og:title" content="' . esc_attr( apply_filters( 'wpfbogp_title', $wpfbogp_title ) ) . '">' . "\n";
    
    		// do descriptions
    		if ( is_singular() ) {
    			if ( has_excerpt( $post->ID ) ) {
    				$wpfbogp_description = strip_tags( get_the_excerpt( $post->ID ) );
    			} else {
    				$wpfbogp_description = str_replace( "\r\n", ' ' , substr( strip_tags( strip_shortcodes( $post->post_content ) ), 0, 160 ) );
    			}
    		} else {
    			$wpfbogp_description = get_bloginfo( 'description' );
    		}
    		echo '<meta property="og:description" content="' . esc_attr( apply_filters( 'wpfbogp_description', $wpfbogp_description ) ) . '">' . "\n";

    I removed these two bunches of code from wp-facebook-ogp.php and that seems to have done the trick. Are there any other repercussions to removing this code?

  3. sdaveCL
    Member
    Posted 2 years ago #

    Never mind. I just realized there is a check box in WordPress SEO to add Open Graph tags that I forgot about. Unchecked that, added the code back to the php file, and it all works fine. *dunce*

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic