Permalink
Browse files

add basic support for array values

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 d987eb76e2da1431e5df3311fde3d9c2407b06f5
Showing with 7 additions and 1 deletion.
  1. +7 −1 opengraph.php
View
@@ -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');

0 comments on commit d987eb7

Please sign in to comment.