• Resolved norboo

    (@norboo)


    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:

    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.

    https://www.ads-software.com/plugins/piklist/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Grouping user taxonomy terms’ is closed to new replies.