functions - How to add meta fields to custom taxonomy addedit page?

admin2025-01-07  5

I have a custom taxonomy 'issue'. I tried to add some meta fields to the add/edit issue pages in the dashboard using the method explained by Ohad Raz (/). So i downloaded the files from github (), put them in the child theme folder & add these lines to child theme functions.php:

require_once( get_stylesheet_directory() . '/Tax-meta-class/Tax-meta-class.php' );

$config = array(
   'id' => 'demo_meta_box',
   'title' => 'Demo Meta Box',
   'pages' => array('issue'),
   'context' => 'normal',
   'fields' => array(),
   'local_images' => false,
   'use_with_theme' => false
);
$my_meta = new Tax_Meta_Class($config);
$my_meta->addText('text_field_id',array('name'=> 'My Text '));
$my_meta->addTextarea('textarea_field_id',array('name'=> 'My Textarea '));
$my_meta->addDate('date_field_id',array('name'=> 'My Date '));
$my_meta->addImage('image_field_id',array('name'=> 'My Image '));
$my_meta->addFile('file_field_id',array('name'=> 'My File '));
$my_meta->Finish();

So, now all fields are added to the add/edit taxonomy dashboard page. But, without the css style. Although there is a css file in the tax-meta-class folder/css, fields added to the dashboard have no style, even add image/add file buttons don't open, date picker is displayed as a normal text field. I couldn't figure out how to apply the css code on those created fields. Can you help me please?

I have a custom taxonomy 'issue'. I tried to add some meta fields to the add/edit issue pages in the dashboard using the method explained by Ohad Raz (https://en.bainternet.info/wordpress-taxonomies-extra-fields-the-easy-way/). So i downloaded the files from github (https://github.com/bainternet/Tax-Meta-Class), put them in the child theme folder & add these lines to child theme functions.php:

require_once( get_stylesheet_directory() . '/Tax-meta-class/Tax-meta-class.php' );

$config = array(
   'id' => 'demo_meta_box',
   'title' => 'Demo Meta Box',
   'pages' => array('issue'),
   'context' => 'normal',
   'fields' => array(),
   'local_images' => false,
   'use_with_theme' => false
);
$my_meta = new Tax_Meta_Class($config);
$my_meta->addText('text_field_id',array('name'=> 'My Text '));
$my_meta->addTextarea('textarea_field_id',array('name'=> 'My Textarea '));
$my_meta->addDate('date_field_id',array('name'=> 'My Date '));
$my_meta->addImage('image_field_id',array('name'=> 'My Image '));
$my_meta->addFile('file_field_id',array('name'=> 'My File '));
$my_meta->Finish();

So, now all fields are added to the add/edit taxonomy dashboard page. But, without the css style. Although there is a css file in the tax-meta-class folder/css, fields added to the dashboard have no style, even add image/add file buttons don't open, date picker is displayed as a normal text field. I couldn't figure out how to apply the css code on those created fields. Can you help me please?

Share Improve this question asked Sep 8, 2015 at 10:10 nisrnisr 714 silver badges17 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

After reviewing the code more & more I found the solution. So, for those who have interest in such thing:

  1. change false to true in use_with_theme
  2. change template path to stylesheet path in tax-meta-class.php

Cheers

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1736261427a741.html

最新回复(0)