WordPress.org

Plugin Directory

Changeset 627275


Ignore:
Timestamp:
11/19/12 20:33:51 (17 months ago)
Author:
mdawaffe
Message:

Open Graph tags: Include an empty description tag in an attempt to prevent FB from pulling one from a post-only image (which means it'll end up with the text from sharing buttons or something else weird).

Props @beau

File:
1 edited

Legend:

Unmodified
Added
Removed
  • jetpack/trunk/functions.opengraph.php

    r624823 r627275  
    3434            $tags['fb:admins'] = $facebook_admins; 
    3535 
    36     } elseif ( is_author() ) { 
     36    } else if ( is_author() ) { 
    3737        $tags['og:type'] = 'author'; 
    3838 
     
    4343        $tags['og:description'] = $author->description; 
    4444 
    45     } elseif ( is_singular() ) { 
     45    } else if ( is_singular() ) { 
    4646        global $post; 
    4747        setup_postdata( $post ); 
     
    5151        $tags['og:url'] = get_permalink(); 
    5252        $tags['og:description'] = strip_tags( get_the_excerpt() ); 
     53 
     54        // Force a description, to avoid FB getting its own 
     55        if ( empty( $tags['og:description'] ) ) 
     56            $tags['og:description'] = ' '; 
     57 
    5358    } 
    5459 
Note: See TracChangeset for help on using the changeset viewer.