Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php add_action ( 'edit_category_form_fields', 'extra_category_fields');
- //add extra fields to category edit form callback function
- function extra_category_fields( $tag ) { //check for existing featured ID
- $t_id = $tag->term_id;
- $cat_meta = get_option( "category_$t_id");
- ?>
- <label for="extra3"><?php _e('More field'); ?></label>
- <?php $settings = array( 'textarea_name' => 'css[extra3]' ); wp_editor( $cat_meta['extra3'], 'css-extra3',$settings ); ?>
- <?php
- add_action ( 'edited_category', 'save_extra_category_fileds');
- // save extra category extra fields callback function
- function save_extra_category_fileds( $term_id ) {
- if ( isset( $_POST['css'] ) ) {
- $t_id = $term_id;
- $cat_meta = get_option( "category_$t_id");
- $cat_keys = array_keys($_POST['css']);
- foreach ($cat_keys as $key){
- if (isset($_POST['css'][$key])){
- $cat_meta[$key] = $_POST['css'][$key];
- }
- }
- //save the option array
- update_option( "category_$t_id", $cat_meta );
- }
- }
- } ?>
- <?php $cat_id = Category_ID;
- $cat_data = get_option("category_$cat_id");
- echo do_shortcode($cat_data['extra3']); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement