Skip to content

Commit

Permalink
fix: 🐛 fixed terms meta
Browse files Browse the repository at this point in the history
  • Loading branch information
ElisaLosito committed Dec 11, 2020
1 parent 10a9099 commit f160afa
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
28 changes: 14 additions & 14 deletions Malini/Decorators/WithTaxonomies.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,21 @@ public function decorate(Post $post, array $options = []): Post
$terms = [];
foreach ($post_taxonomies as $taxonomy) {
$terms_by_taxonomy = get_the_terms($wp_post->ID, $taxonomy);
if (isset($options['options']) && in_array('add_term_meta', $options['options'])) {
$terms_by_taxonomy = array_map(
function($term) {
$term_meta = get_term_meta($term->term_id);
if (!empty($term_meta)) {
foreach ($term_meta as $key => $value) {
$term->{$key} = $value;
}
}
return $term;
},
$terms_by_taxonomy
);
}
if (is_array($terms_by_taxonomy)) {
if (isset($options['options']) && in_array('add_term_meta', $options['options'])) {
$terms_by_taxonomy = array_map(
function($term) {
$term_meta = get_term_meta($term->term_id);
if (!empty($term_meta)) {
foreach ($term_meta as $key => $value) {
$term->{$key} = $value;
}
}
return $term;
},
$terms_by_taxonomy
);
}
if (isset($options['options']) && in_array('show_taxonomy_key', $options['options'])) {
$terms[$taxonomy] = $terms_by_taxonomy;
} else {
Expand Down
2 changes: 1 addition & 1 deletion Malini/Malini.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class Malini
{
public const VERSION = '1.1.2';
public const VERSION = '1.1.3';

protected static $instance = null;

Expand Down
2 changes: 1 addition & 1 deletion malini.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* Plugin Name: Malini
* Plugin URI: https://github.com/caffeinalab/malini
* Description: Malini is an extensible content decoration and normalization library for WordPress entities.
* Version: 1.1.2
* Version: 1.1.3
* Author: Caffeina
* Author URI: https://caffeina.com
* Text Domain: malini
Expand Down

0 comments on commit f160afa

Please sign in to comment.