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

Commit

Permalink
Update code standards a bit, and update readme w/ version/props.
Browse files Browse the repository at this point in the history
  • Loading branch information
jtsternberg committed Jan 14, 2015
1 parent 059522e commit 9e5a482
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
3 changes: 3 additions & 0 deletions README.md
Expand Up @@ -176,6 +176,9 @@ cmb2_taxonomy_meta_initiate();

#### Changelog

* 0.2.2
* Add filter to disable form in taxonomy add-new section. [Props @billerickson](https://github.com/jtsternberg/Taxonomy_MetaData/pull/20).

* 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.

Expand Down
18 changes: 10 additions & 8 deletions Taxonomy_MetaData.php
Expand Up @@ -3,7 +3,7 @@
if ( ! class_exists( 'Taxonomy_MetaData' ) ) :
/**
* Adds pseudo term meta functionality
* @version 0.2.1
* @version 0.2.2
* @author Justin Sternberg
*/
class Taxonomy_MetaData {
Expand Down Expand Up @@ -122,17 +122,19 @@ public function loop_fields( $alldata, $cb ) {
public function hooks() {

// Display our form data
add_action( $this->taxonomy .'_edit_form', array( $this, 'metabox_edit' ), 8, 2 );
if( apply_filters( 'taxonomy_metadata_display_on_' . $this->taxonomy . '_add_form', true ) )
add_action( $this->taxonomy .'_add_form_fields', array( $this, 'metabox_edit' ), 8, 2 );
add_action( "{$this->taxonomy}_edit_form", array( $this, 'metabox_edit' ), 8, 2 );

// Display form in add-new section (unless specified not to)
if ( apply_filters( "taxonomy_metadata_display_on_{$this->taxonomy}_add_form", true ) ) {
add_action( "{$this->taxonomy}_add_form_fields", array( $this, 'metabox_edit' ), 8, 2 );
}

// Save our form data
add_action( 'created_'. $this->taxonomy, array( $this, 'save_data' ) );
add_action( 'edited_'. $this->taxonomy, array( $this, 'save_data' ) );
add_action( "created_{$this->taxonomy}", array( $this, 'save_data' ) );
add_action( "edited_{$this->taxonomy}", array( $this, 'save_data' ) );

// Delete it if necessary
add_action( 'delete_'. $this->taxonomy, array( $this, 'delete_data' ) );

add_action( "delete_{$this->taxonomy}", array( $this, 'delete_data' ) );
}

/**
Expand Down

0 comments on commit 9e5a482

Please sign in to comment.