Viewing 5 reply threads
  • Author
    Posts
    • #721
      vsatyarthi
      Member

      Hi,

      First of all – Thanks a many for giving new + more straight way to wordpress development. 🙂 Like it a lott, saves time + code is so much more obvious, quicker and smarter B-)

      How to have 2 dropdowns to select parent-child categories related?

      Are their auto-complete drop-downs coming??

    • #725
      Steve
      Keymaster

      @vsatyarthi– Can you please clarify what you want to do?  An example would really help.

    • #726
      vsatyarthi
      Member

      I need two drop-down menus, first has the parent categories and second will populate child categories based on the selection of first drop down.

      Also, I’ve been trying to have a metabox to set business hours for a custom post type. For that I’m using ‘group’ as field type, according to your documentation. All I wanna do is to save the nested drop-down values only if the checkbox is selected. Below is my code, I’d be grateful if you can tell me where I’m mistaking. below is my code

       

       

       

      $timing = array(

      ’06:00 am’ => ’06:00 am’

      ,’06:30 am’ => ’06:30 am’

      ,’07:00 am’ => ’07:00 am’

      ,’07:30 am’ => ’07:30 am’

      ,’08:00 am’ => ’08:00 am’

      ,’08:30 am’ => ’08:30 am’

      ,’09:00 am’ => ’09:00 am’

      ,’09:30 am’ => ’09:30 am’

      ,’10:00 am’ => ’10:00 am’

      ,’10:30 am’ => ’10:30 am’

      ,’11:00 am’ => ’11:00 am’

      ,’11:30 am’ => ’11:30 am’

      ,’12:00 am’ => ’12:00 am’

      ,’12:30 am’ => ’12:30 am’

      ,’01:00 pm’ => ’01:00 am’

      ,’01:30 pm’ => ’01:30 am’

      ,’02:00 pm’ => ’02:00 am’

      ,’02:30 pm’ => ’02:30 am’

      ,’03:00 pm’ => ’03:00 am’

      ,’03:30 pm’ => ’03:30 am’

      ,’04:00 pm’ => ’04:00 am’

      ,’04:30 pm’ => ’04:30 am’

      ,’05:00 pm’ => ’05:00 am’

      ,’05:30 pm’ => ’05:30 am’

      ,’06:00 pm’ => ’06:00 am’

      ,’06:30 pm’ => ’06:30 am’

      ,’07:00 pm’ => ’07:00 am’

      ,’07:30 pm’ => ’07:30 am’

      ,’08:00 pm’ => ’08:00 am’

      ,’08:30 pm’ => ’08:30 am’

      ,’09:00 pm’ => ’09:00 am’

      ,’09:30 pm’ => ’09:30 am’

      ,’10:00 pm’ => ’10:00 am’

      ,’10:30 pm’ => ’10:30 am’

      ,’11:00 pm’ => ’11:00 am’

      ,’11:30 pm’ => ’11:30 am’

      ,’12:00 pm’ => ’12:00 am’

      ,’12:30 pm’ => ’12:30 am’

      ,’01:00 am’ => ’01:00 am’

      ,’01:30 am’ => ’01:30 am’

      ,’02:00 am’ => ’02:00 am’

      ,’02:30 am’ => ’02:30 am’

      ,’03:00 am’ => ’03:00 am’

      ,’03:30 am’ => ’03:30 am’

      ,’04:00 am’ => ’04:00 am’

      ,’04:30 am’ => ’04:30 am’

      ,’05:00 am’ => ’05:00 am’

      ,’05:30 am’ => ’05:30 am’

      );

      piklist(‘field’, array(

      ‘type’ => ‘checkbox’

      ,’field’ => ‘business_day’

      ,’label’ => ‘Business Day’

      ,’attributes’ => array(

      ‘class’ => ‘text’

      ,’id’ => ”

      )

      ,’value’ => array(‘monday’,’tuesday’,’wednesday’,’thursday’,’friday’,’saturday’,’sunday’)

      ,’choices’ => array(

      ‘monday’ => ‘monday [field=monday]’

      ,’tuesday’ => ‘tuesday [field=tuesday]’

      ,’wednesday’ => ‘wednesday [field=wednesday]’

      ,’thursday’ => ‘thursday [field=thursday]’

      ,’friday’ => ‘friday [field=friday]’

      ,’saturday’ => ‘saturday [field=saturday]’

      ,’sunday’ => ‘sunday [field=sunday]’

      )

      ,’fields’ => array(

      array(

      ‘type’ => ‘group’

      ,’field’ => ‘monday’

      ,’label’ => ‘monday’

      ,’columns’ => 12

      ,’fields’ => array(

      array(

      ‘type’ => ‘select’

      ,’field’ => ‘open_time’

      ,’label’ => ‘open time’

      ,’columns’ => 4

      ,’choices’ => $timing

      )

      ,array(

      ‘type’ => ‘select’

      ,’field’ => ‘close_time’

      ,’label’ => ‘close time’

      ,’columns’ => 4

      ,’choices’ => $timing

      )

      )

      )

      ,array(

      ‘type’ => ‘group’

      ,’field’ => ‘tuesday’

      ,’label’ => ‘tuesday’

      ,’columns’ => 12

      ,’fields’ => array(

      array(

      ‘type’ => ‘select’

      ,’field’ => ‘open_time’

      ,’label’ => ‘open time’

      ,’columns’ => 4

      ,’choices’ => $timing

      )

      ,array(

      ‘type’ => ‘select’

      ,’field’ => ‘close_time’

      ,’label’ => ‘close time’

      ,’columns’ => 4

      ,’choices’ => $timing

      )

      )

      )

      ,array(

      ‘type’ => ‘group’

      ,’field’ => ‘wednesday’

      ,’label’ => ‘wednesday’

      ,’columns’ => 12

      ,’fields’ => array(

      array(

      ‘type’ => ‘select’

      ,’field’ => ‘open_time’

      ,’label’ => ‘open time’

      ,’columns’ => 4

      ,’choices’ => $timing

      )

      ,array(

      ‘type’ => ‘select’

      ,’field’ => ‘close_time’

      ,’label’ => ‘close time’

      ,’columns’ => 4

      ,’choices’ => $timing

      )

      )

      )

      ,array(

      ‘type’ => ‘group’

      ,’field’ => ‘thursday’

      ,’label’ => ‘thursday’

      ,’columns’ => 12

      ,’fields’ => array(

      array(

      ‘type’ => ‘select’

      ,’field’ => ‘open_time’

      ,’label’ => ‘open time’

      ,’columns’ => 4

      ,’choices’ => $timing

      )

      ,array(

      ‘type’ => ‘select’

      ,’field’ => ‘close_time’

      ,’label’ => ‘close time’

      ,’columns’ => 4

      ,’choices’ => $timing

      )

      )

      )

      ,array(

      ‘type’ => ‘group’

      ,’field’ => ‘friday’

      ,’label’ => ‘friday’

      ,’columns’ => 12

      ,’fields’ => array(

      array(

      ‘type’ => ‘select’

      ,’field’ => ‘open_time’

      ,’label’ => ‘open time’

      ,’columns’ => 4

      ,’choices’ => $timing

      )

      ,array(

      ‘type’ => ‘select’

      ,’field’ => ‘close_time’

      ,’label’ => ‘close time’

      ,’columns’ => 4

      ,’choices’ => $timing

      )

      )

      )

      ,array(

      ‘type’ => ‘group’

      ,’field’ => ‘saturday’

      ,’label’ => ‘saturday’

      ,’columns’ => 12

      ,’fields’ => array(

      array(

      ‘type’ => ‘select’

      ,’field’ => ‘open_time’

      ,’label’ => ‘open time’

      ,’columns’ => 4

      ,’choices’ => $timing

      )

      ,array(

      ‘type’ => ‘select’

      ,’field’ => ‘close_time’

      ,’label’ => ‘close time’

      ,’columns’ => 4

      ,’choices’ => $timing

      )

      )

      )

      ,array(

      ‘type’ => ‘group’

      ,’field’ => ‘sunday’

      ,’label’ => ‘sunday’

      ,’columns’ => 12

      ,’fields’ => array(

      array(

      ‘type’ => ‘select’

      ,’field’ => ‘open_time’

      ,’label’ => ‘open time’

      ,’columns’ => 4

      ,’choices’ => $timing

      )

      ,array(

      ‘type’ => ‘select’

      ,’field’ => ‘close_time’

      ,’label’ => ‘close time’

      ,’columns’ => 4

      ,’choices’ => $timing

      )

      )

      )

      )

      ));

       

    • #731
      Steve
      Keymaster

      @vsatyarthi– I’m sorry, I really don’t understand.  Can you explain in detail, or provide a line drawing?

    • #738
      vsatyarthi
      Member

      I’m sorry, I wasn’t clear to the question.

      Please take a look on these images.

      http://s22.postimg.org/efot1ppmp/business_hours.png

      http://s22.postimg.org/tpoo8wl4x/category_selection.png

       

      Rightnow I’m doing it with wordpress core functions, I’m curious how to achieve this with piklist.

      On business hours, check box decides what day to be save as post_meta

      Piklist saves hours of work and code is properly structured and easy to understand for me, thats why I’m looking forward if such kind of functionality can be achieved with this framework

    • #739
      Steve
      Keymaster

      @vsatyarthi– The screenshots definitely helped!

      You may want to try a CHECKBOX field with NESTED fields. A sample of this is shown in the Piklist demo, in the CHECKBOX meta box.  The code is located in: plugins/piklist/add-ons/piklist-demos/parts/meta-boxes/field-checkbox.php

      Let us know if that works for you.

       

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