Viewing 3 reply threads
  • Author
    Posts
    • #4855
      hozefasmile
      Member

      Hi,

      I am using piklist beta 0.9.9.6

      I have followed the documentation and first added this code in theme’s functions.php file

      add_filter('piklist_admin_pages', 'piklist_theme_setting_pages');
        function piklist_theme_setting_pages($pages)
        {
           $pages[] = array(
            'page_title' => __('Custom Settings')
            ,'menu_title' => __('Settings', 'piklist')
            ,'sub_menu' => 'themes.php' //Under Appearance menu
            ,'capability' => 'manage_options'
            ,'menu_slug' => 'custom_settings'
            ,'setting' => 'my_theme_settings'
            ,'menu_icon' => plugins_url('piklist/parts/img/piklist-icon.png')
            ,'page_icon' => plugins_url('piklist/parts/img/piklist-page-icon-32.png')
            ,'single_line' => true
            ,'default_tab' => 'Basic'
            ,'save_text' => 'Save Demo Settings'
          );
       
          return $pages;
        }

      Then I created two files under theme folder/piklist/parts/settings/
      1. my-settings-section.php

      <?php
      /*
       Title: Theme Settings Section
       Setting: my_theme_settings
       */
      piklist('field', array(
        'type' => 'text'
        ,'field' => 'text'
        ,'label' => 'Text Box'
        ,'description' => 'Field Description'
        ,'help' => 'This is help text.'
        ,'value' => 'Default text'
        ,'attributes' => array(
        'class' => 'text'
        )
       ));
       
      piklist('field', array(
       'type' => 'select'
       ,'field' => 'select'
       ,'label' => 'Select Box'
       ,'description' => 'Choose from the drop-down.'
       ,'help' => 'This is help text.'
       ,'attributes' => array(
       'class' => 'text'
       )
       ,'choices' => array(
         'option1' => 'Option 1'
         ,'option2' => 'Option 2'
         ,'option3' => 'Option 3'
       )
       ));
       
      piklist('field', array(
       'type' => 'colorpicker'
       ,'field' => 'colorpicker'
       ,'label' => 'Choose a color'
       ,'value' => '#aee029'
       ,'description' => 'Click in the box to select a color.'
       ,'help' => 'This is help text.'
       ,'attributes' => array(
        'class' => 'text'
       )
       ));
      ?>

      2. my-settings-2.php

      <?php
      /*
      Title: My Settings Section
      Setting: my_theme_settings
      Tab: Advanced
      */
       
      // Let's create a text box field
       piklist('field', array(
         'type' => 'text'
         ,'field' => 'field_name003'
         ,'label' => __('Example Field 3')
         ,'description' => __('Field Description')
         ,'attributes' => array(
           'class' => 'text'
         )
       ));
       // Let's create a text box field
       piklist('field', array(
         'type' => 'text'
         ,'field' => 'field_name004'
         ,'label' => __('Example Field 4')
         ,'description' => __('Field Description')
         ,'attributes' => array(
           'class' => 'text'
         )
       ));
       ?>

      Thanks
      Hozefa

    • #4860
      kplaneta
      Member

      To make tabs work you need to set up a workflow. It’s all written in the docs.

    • #4873
      Steve
      Keymaster
      This reply has been marked as private.
    • #4874
      Steve
      Keymaster
Viewing 3 reply threads
  • You must be logged in to reply to this topic.