Skip to content
This repository has been archived by the owner on Feb 15, 2024. It is now read-only.

Commit

Permalink
Make Taxonomy_MetaData::get() work the same way when using CMB2 versi…
Browse files Browse the repository at this point in the history
…on, aka, return all options for a term if no key is provided.
  • Loading branch information
jtsternberg committed Jan 6, 2015
1 parent aa3ec7e commit 42b3147
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ cmb2_taxonomy_meta_initiate();

#### Changelog

* 0.2.1
* Make Taxonomy_MetaData::get() work the same way when using CMB2 version, aka, return all options for a term if no key is provided.

* 0.2.0
* Make CMB extended class use CMB2 instead.

Expand Down
2 changes: 1 addition & 1 deletion Taxonomy_MetaData.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
if ( ! class_exists( 'Taxonomy_MetaData' ) ) :
/**
* Adds pseudo term meta functionality
* @version 0.2.0
* @version 0.2.1
* @author Justin Sternberg
*/
class Taxonomy_MetaData {
Expand Down
8 changes: 6 additions & 2 deletions Taxonomy_MetaData_CMB2.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
if ( ! class_exists( 'Taxonomy_MetaData_CMB2' ) ) :
/**
* Adds pseudo term meta functionality
* @version 0.2.0
* @version 0.2.1
* @author Justin Sternberg
*/
class Taxonomy_MetaData_CMB2 extends Taxonomy_MetaData {
Expand Down Expand Up @@ -132,7 +132,11 @@ public function get_meta( $term_id, $key = '' ) {

$this->do_override_filters( $term_id );

return cmb2_get_option( $this->id( $term_id ), $key );
$value = $key
? cmb2_get_option( $this->id( $term_id ), $key )
: cmb2_options( $this->id( $term_id ) )->get_options();

return $value;
}

}
Expand Down

0 comments on commit 42b3147

Please sign in to comment.