-
-
Save pippinsplugins/3489713 to your computer and use it in GitHub Desktop.
Add a checkbox to Taxonomy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Edit term page | |
function summit_taxonomy_edit_meta_field($term) { | |
// put the term ID into a variable | |
$t_id = $term->term_id; | |
// retrieve the existing value(s) for this meta field. This returns an array | |
$term_meta = get_option( "taxonomy_$t_id" ); ?> | |
<tr class="form-field"> | |
<th scope="row" valign="top"><label for="term_meta[displayed]"><?php _e( 'Display Category', 'summit' ); ?></label></th> | |
<td> | |
<input type="checkbox" name="term_meta[displayed]" id="term_meta[displayed]" value="1" <?php if( isset( $term_meta['displayed'] ) ) { ?>checked="checked"<?php } ?> "> | |
<p class="description"><?php _e( 'Check to have the Category to displayed on the Sales Page','summit' ); ?></p> | |
</td> | |
</tr> | |
<?php | |
} | |
add_action( 'category_edit_form_fields', 'summit_taxonomy_edit_meta_field', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment