Skip to content

Commit

Permalink
add basic support for array values
Browse files Browse the repository at this point in the history
this handles only the most basic case of having multiples values for a
given property.  This address the first half (the easy half) of #5.  It
doesn't handle the hard part of multiple property bundles (see details
in #5).
  • Loading branch information
willnorris committed May 21, 2012
1 parent f476552 commit d987eb7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion opengraph.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,13 @@ function opengraph_meta_tags() {
$metadata = opengraph_metadata();
foreach ( $metadata as $key => $value ) {
if ( empty($key) || empty($value) ) continue;
echo '<meta property="' . esc_attr($key) . '" content="' . esc_attr($value) . '" />' . "\n";
if ( is_array( $value ) ) {
foreach ( $value as $v ) {
echo '<meta property="' . esc_attr($key) . '" content="' . esc_attr($v) . '" />' . "\n";
}
} else {
echo '<meta property="' . esc_attr($key) . '" content="' . esc_attr($value) . '" />' . "\n";
}
}
}
add_action('wp_head', 'opengraph_meta_tags');
Expand Down

0 comments on commit d987eb7

Please sign in to comment.