Viewing 3 reply threads
  • Author
    Posts
    • #2567
      prasenjit
      Member

      Hi,

      I am trying to use the multi-select field using the tutorial published here: but it is not working.

      Here is my code:

      
      piklist( 'field', array(
      	'type'        => 'select',
      	'scope'       => 'taxonomy',
      	'field'       => 'languages',
      	'label'       => __('Languages'),
      	'description' => __('Select languages.'),
      	'columns' => '12',
      	'choices'     => piklist(
      		get_terms( 'language', array(
      			'hide_empty' => false
      		) ),
      		array(
      			'term_id',
      			'name'
      		)
      	),
      	'attributes' => array(
      		'multiple'
      	)
      ) );
      

      Am I doing it wrong? I also tried the user contributed field ‘select2’ from the github repo . Even that isn’t working. Did you guys ever integrate the select2 field?

      Thanks.

    • #2570
      Steve
      Keymaster

      Does it work in a the built-in Demos? Under the LISTS tab.

    • #2571
      prasenjit
      Member

      Yes it does. You need to rectify your tutorial

      As given in the tutorial:

      'attributes' => array(
        'multiple'
      )

      and the correct code should be (taken from field-multiselect.php under demos):

      'attributes' => array(
        'multiple' => 'multiple'
      )

      Also @Steve is there any plans of integrating Select2 or Chosen fields? If not, then a tutorial about creating new field types would be of great help.

    • #2572
      Steve
      Keymaster

      @prasenjit– Documentation has been updated! Thanks for the help.

      In regards with Select2 or Chosen, we are going to wait and see what happens in WordPress 4.1. They might be integrating one of those fields.

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