Viewing 3 reply threads
  • Author
    Posts
    • #1770
      norboo
      Member

      I created a user taxonomy called “Company Types” which shows nicely on user profiles as a checkbox list.

      
      /* Register Taxonomy */
      
      function piklist_custom_taxonomies($taxonomies)
        {
          $taxonomies[] = array(
            'object_type' => 'user'
            ,'name' => 'company_type'
            ,'configuration' => array(
              'hierarchical' => true
              ,'labels' => piklist('taxonomy_labels', 'Company Type')
              ,'show_ui' => true
              ,'query_var' => true
              ,'rewrite' => array(
                'slug' => 'business-directory'
              )
              ,'show_admin_column' => true
            )
          );
      
          return $taxonomies;
        }
      
      /* User Fields */
      piklist('field', array(
      	'type' => 'checkbox'
      	,'scope' => 'taxonomy'
      	,'field' => 'company_type'
      	,'label' => 'Company Types'
      	,'description' => 'Choose only two categories.'
      	,'choices' => piklist(
      		get_terms('company_type', array(
      			'hide_empty' => false
      		))
      		,array(
      			'term_id'
      			,'name'
      		)
      	)
      ));
      

      I’d like to know if there is a way to group the terms as follows and not just a flat list of parents and child all with checkboxes:

      User Taxonomies

      ParentTerm#1 (no checkbox)
      []Child#1-1
      []Child#1-2
      []Child#1-3

      ParentTerm#2 (no checkbox)
      []Child#1-1
      []Child#1-2
      []Child#1-3

      Any lead is greatly appreciated.

    • #1774
      Steve
      Keymaster

      Felt like this needed a tutorial. Let me know if this helps >

    • #1780
      norboo
      Member

      Thanks Steve!
      Exactly what I needed!

      Amazing plugin and…amazing people!

    • #1782
      Steve
      Keymaster

      @norboo– Glad the tutorial worked for you. Thanks for the great idea.

Viewing 3 reply threads
  • You must be logged in to reply to this topic.