Viewing 6 reply threads
  • Author
    Posts
    • #2352
      tuckerjoenz
      Member

      I’m trying to pull in all menus that the user has created in a select field. Can anyone tell me why this isn’t working? Thanks in advance!

      piklist('field', array(
        'type' => 'select'
        ,'field' => 'submenu_selection'
        ,'value' => 'option1' // Sets default to Option 2
        ,'label' => 'Sub Menu'
        ,'description' => 'This is where to select what sub menu you need.'
        ,'attributes' => array(
          'class' => 'text'
        )
        ,'choices' => array(
            piklist( return get_terms( 'nav_menu', array( 'hide_empty' => true ) ) );
        )
      ));
    • #2353
      Marcus
      Member

      Lose return:
      piklist( get_terms( 'nav_menu', array( 'hide_empty' => true ) ) );

      Marcus

    • #2354
      tuckerjoenz
      Member

      @Marcus thanks but that didn’t seem to work.

    • #2355
      Marcus
      Member

      You’re right Tucker.
      I should have been a little more observant.

      Sorry about that. It was just a glaring one so I jumped. 🙂

      Here’s the proper usage of get_terms in a piklist select field:

          ,'choices' => piklist(
            get_terms('piklist_demo_type', array(
              'hide_empty' => false
            ))
            ,array(
              'term_id'
              ,'name'
            )
          )
      

      Hope that helps bud.

      Marcus

    • #2356
      tuckerjoenz
      Member

      @Marcus that is PERFECT! Thank you you! 🙂

    • #2358
      Marcus
      Member

      No problem Tucker. Keep up the good work. 🙂

      Hope the project goes well.

      Marcus

    • #2359
      tuckerjoenz
      Member

      Thanks Marcus! I do too LOL 🙂

Viewing 6 reply threads
  • The topic ‘Using get_terms to pull in menus into select field’ is closed to new replies.