Posts

Showing posts with the label custom-taxonomy

How to add custom field in wordpress post taxonomy or in other custom taxonomy just like set feature image in taxonomy

Just copy and paste below code into your theme's functions.php file or into your custom plugin file and change taxonomy slug according to your requirement. <?php // Here i used custom taxonomy people_cat , You can also use post's default taxonomy like category , tag add_action( 'people_cat_add_form_fields', '_rj_add_category_fields' ); add_action( 'people_cat_edit_form_fields','_rj_edit_category_fields'); function _rj_add_category_fields($taxonomy) {  global $wpdb;   ?>   <div class="form-field">    <label><?php _e( 'Thumbnail', 'restlessdance' ); ?></label>    <div id="<?php echo $taxonomy; ?>_thumbnail" style="float: left; margin-right: 10px;"><img src="<?php echo esc_url( rj_placeholder_img_src() ); ?>" width="60px" height="60px" /></div>    <div style="line-height: 60px;">     <input ty...

How to create or register custom taxonomy like categories or tag for custom post type or default post type wordpress

For create a custom taxonomy for your custom post type just copy and paste below code into your theme's functions.php add_action( 'init', 'rj_create_guide_taxonomy', 0 ); function rj_create_guide_taxonomy() { $labels = array( 'name'              => _x( 'Categories', 'taxonomy general name' ), 'singular_name'     => _x( 'Category', 'taxonomy singular name' ), 'search_items'      => __( 'Search Categories' ), 'all_items'         => __( 'All Categories' ), 'parent_item'       => __( 'Parent Category' ), 'parent_item_colon' => __( 'Parent Category:' ), 'edit_item'         => __( 'Edit Category' ), 'update_item'       => __( 'Update Category' ), 'add_new_item'      => __( 'Add New Category' ), 'new_item_name'     => __( 'New Category ...

How to add a custom field in custom taxonomy or how to add a image field for custom taxonomy like woocommerce produc_cat in wordpress

How to add a custom field in custom taxonomy or how to add a image field for custom taxonomy like woocommerce produc_cat in wordpress For add a custom field in custom taxonomy or add a image field for custom taxonomy just copy below code and add it into your theme's functions.php file and change a taxonomy slug as per your need. // actual action for add add_action( '{custom-taxonomy-slug}_add_form_fields', 'rj_video_categories_add_category_fields' ); //actual action for edit  add_action( '{custom-taxonomy-slug}_edit_form_fields','rj_video_categories_edit_category_fields'  ); add_action( 'video-categories_add_form_fields', 'rj_video_categories_add_category_fields' ); add_action( 'video-categories_edit_form_fields','rj_video_categories_edit_category_fields'  ); function rj_video_categories_add_category_fields() { global $wpdb; ?> <div class="form-field"> <label><?php _e...