<? php
function boke8_net_add_category_field ( ) {
echo '<div class="form-field">
<label for="tag title">Customize the title</label>
<input name="tag-title" id="tag-title" type="text" value="" size="40">
<p>Please enter here for SEO Optimized title</ p>
</div>' ;
echo '<div class="form-field">
<label for="tag keywords">Custom keywords</label>
<input name="tag-keywords" id="tag-keywords" type="text" value="" size="40">
<p>Please enter keywords for SEO optimization here</ p>
</div>' ;
echo '<div class="form-field">
<label for="tag description">User defined description</label>
<textarea name="tag-description" id="tag-description" class="large-text" rows="5" cols="50"></textarea>
<p>Please enter keywords for SEO optimization here</ p>
</div>' ;
}
function boke8_net_edit_category_field ( $tag ) {
echo '<tr class="form-field">
<th scope="row"><label for="tag title">Custom title</label></th>
<td>
<p><input name="tag-title" id="tag-title" type="text" value="' ;
echo get_option ( '_category_title' . $tag -> term_id ) . '" size="40"/></p>
<p class="description">Please enter the title for SEO optimization here</ p>
</td>
</tr>' ;
echo '<tr class="form-field">
<th scope="row"><label for="tag keywords">user-defined keywords</label></th>
<td>
<p><input name="tag-keywords" id="tag-keywords" type="text" value="' ;
echo get_option ( '_category_keywords' . $tag -> term_id ) . '" size="40"/></p>
<p class="cat url">Please enter keywords for SEO optimization here</ p>
</td>
</tr>' ;
echo '<tr class="form-field">
<th scope="row"><label for="tag description">User defined description</label></th>
<td>
<p><textarea name="tag-description" id="tag-description" class="large-text" rows="5" cols="50">' . get_option ( '_category_description' . $tag -> term_id ) . '</textarea></p>
<p class="cat url">Please enter a description for SEO optimization here</ p>
</td>
</tr>' ;
}
function boke8_net_taxonomy_metadate ( $term_id ) {
if ( isset ( $_POST [ 'tag-title' ] ) && isset ( $_POST [ 'tag-keywords' ] ) && isset ( $_POST [ 'tag-description' ] ) ) {
if ( ! current_user_can ( 'manage_categories' ) ) {
return $term_id ;
}
$title_key = '_category_title' . $term_id ; //The key option is cat-tel-1 type
$title_value = $_POST [ 'tag-title' ] ; // value
$word_key = '_category_keywords' . $term_id ;
$word_value = $_POST [ 'tag-keywords' ] ;
$desc_key = '_category_description' . $term_id ;
$desc_value = $_POST [ 'tag-description' ] ;
update_option ( $title_key , $title_value ) ;
update_option ( $word_key , $word_value ) ;
update_option ( $desc_key , $desc_value ) ;
}
}
add_action ( 'category_add_form_fields' , 'boke8_net_add_category_field' , ten , two ) ;
add_action ( 'category_edit_form_fields' , 'boke8_net_edit_category_field' , ten , two ) ;
add_action ( 'created_category' , 'boke8_net_taxonomy_metadate' , ten , one ) ;
add_action ( 'edited_category' , 'boke8_net_taxonomy_metadate' , ten , one ) ;
add_action ( 'post_tag_add_form_fields' , 'boke8_net_add_category_field' , ten , two ) ;
add_action ( 'post_tag_edit_form_fields' , 'boke8_net_edit_category_field' , ten , two ) ;
add_action ( 'edited_post_tag' , 'boke8_net_taxonomy_metadate' , ten , one ) ;
add_action ( 'create_post_tag' , 'boke8_net_taxonomy_metadate' , ten , one ) ;
?>
echo get_option ( '_category_title' . get_queried_object_id ( ) ) ;
echo get_option ( '_category_keywords' . get_queried_object_id ( ) ) ;
echo get_option ( '_category_description' . get_queried_object_id ( ) ) ;