Tagged: , ,

Viewing 1 reply thread
  • Author
    Posts
    • #6832
      Rachel
      Member

      I’ve been trying to add a custom taxonomy, that in lieu of the required ‘Name’ field, using say, a piklist drop down. I’ve tried variations of the following to no success. Is this something that’s supported the way 'scope' => 'post', 'field' => 'post_title' is?

      piklist('field', array(
        'type'      => 'select',
        'field'     => 'name',
        'scope'     => 'taxonomy',
        'choices' => piklist_get_states_and_slugs(true),
      ));
      Attachments:
      You must be logged in to view attached files.
    • #6834
      Jason
      Keymaster

      Hi @Rachel!

      This is definitely possible! You can see an example of this in the Piklist Demos. Create a new Piklist Demos Post and then you’ll see the “Taxonomies” metabox on the side. You can also find the metabox in /piklist/add-ons/piklist-demos/parts/meta-boxes/field-taxonomies.php. For ease I’ll paste it here, too:

      piklist('field', array(
        'type' => 'checkbox'
        ,'scope' => 'taxonomy'
        ,'field' => 'piklist_demo_type'
        ,'label' => __('Demo Types', 'piklist-demo')
        ,'description' => sprintf(__('Terms will appear when they are added to %1$s the Demo taxonomy %2$s.','piklist-demo'), '<a href="' . network_admin_url() . 'edit-tags.php?taxonomy=piklist_demo_type&post_type=piklist_demo">', '</a>')
        ,'choices' => piklist(
          get_terms('piklist_demo_type', array(
            'hide_empty' => false
          ))
          ,array(
            'term_id'
            ,'name'
          )
        )
      ));

      Hope this helps! 🙂

Viewing 1 reply thread
  • You must be logged in to reply to this topic.