Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

use fb prefix for certain keys, #2

  • Loading branch information...
commit 994811fef13ea526f28a8326fcbd91476bfe4c5b 1 parent fb5b818
@billerickson authored
Showing with 7 additions and 2 deletions.
  1. +7 −2 mfields-opengraph-meta-tags.php
View
9 mfields-opengraph-meta-tags.php
@@ -36,8 +36,13 @@ public static function print_meta() {
continue;
}
- /* Append open grapgh prefix to all keys. */
- $property = 'og:' . $key;
+ /* Append facebook prefix to specific keys */
+ if( in_array( $key, array( 'admins', 'app_id' ) ) )
+ $property = 'fb: ' . $key;
+
+ /* Append open graph prefix to all other keys. */
+ else
+ $property = 'og:' . $key;
@mfields
mfields added a note

Awesome find! I love that you're pushing changes back as the Open Graph protocol evolves. I just have a note on coding style here. While I love documentation and think that documentation is super helpful here, it makes it a bit hard (for me) to read here. In cases such as this I prefer to present the docs and then write the code. IMHO it makes both parts easier to read:

/*
 * Append a prefix to all keys.
 * 
 * Facebook prefix for 'admins' and 'app_id'.
 * Open Graph prefix for all others.
 */
if ( in_array( $key, array( 'admins', 'app_id' ) ) )
    $property = 'fb: ' . $key;
else
    $property = 'og:' . $key;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
/* Determine the appropriate escaping function to use. */
$esc = 'esc_attr';

1 comment on commit 994811f

@billerickson

Makes sense to me

Please sign in to comment.
Something went wrong with that request. Please try again.