Tagged: 

Viewing 5 reply threads
  • Author
    Posts
    • #8677
      lulico
      Participant

      I followed the tutorial on here, no dice, rather confused. Developing a plugin. I have custom fields added to my WooCommerce products successfully, and to attributes thereof. But the settings I can’t get to happen.

      myplugin.php contains the following:

      add_filter('piklist_admin_pages', 'woocustom_admin_pages');
      function woocustom_admin_pages($pages)
      {
        $pages[] = array(
          'page_title' => __('Reseller Settings')
          ,'menu_title' => __('Reseller', 'reseller-settings')
          ,'sub_menu' => 'options.php'
          ,'capability' => 'manage_options'
          ,'menu_slug' => 'woocustom_reseller'
          ,'setting' => 'reseller_settings'
          ,'menu_icon' => piklist('url', 'piklist') . '/parts/img/piklist-icon.png'
          ,'page_icon' => piklist('url', 'piklist') . '/parts/img/piklist-page-icon-32.png'
          ,'default_tab' => 'Basic'
          // ,'layout' => 'meta-boxes' // NOTE: Uncomment this to use the meta box layout on this settings page!
          ,'save_text' => 'Save'
        );
      
        return $pages;
      }

      Then in myplugin/piklist/parts/settings/reseller-settings.php is this block of brilliance:

      
      /*
      Title: Linens Reseller Settings
      Setting: reseller_settings
      */
      
      piklist('field', array(
         'type' => 'checkbox',
         'field' => 'show_site_here',
         'label' => 'Display Your Website on our Network Directory Page',
         //'value' => 0, // default
         'choices' => array(
           1 => 'OK',
         )
       )
      );

      What’s wrong with this scripture?

    • #8679
      Steve
      Keymaster

      Instead of options.php, did you mean options-general.php ?

    • #8682
      lulico
      Participant

      What do you know, it works. I can’t believe I didn’t try that. Thank you kindly.

      Now that that’s there, my parts/settings/reseller-settings.php is not in effect. Its header-comment has Setting: reseller_settings and the page options has got its 'setting' => 'woocustom_reseller'. Why is my checkbox missing?

      Also how can I set the menu order? I tried adding 'menu_order' => 1 to the page options array, no dice.

      Thanks much.

    • #8683
      Steve
      Keymaster

      The settings need to match.

      Ordering submenus is a little advanced and not within Piklist. You can manipulate the $submenu global >

    • #8685
      lulico
      Participant

      Sorry I wrote that wrong, the settings do match; it’s Setting: woocustom_reseller, doesn’t show though.

    • #8701
      Steve
      Keymaster

      your code is working for me. See screenshot

      Attachments:
      You must be logged in to view attached files.
Viewing 5 reply threads
  • You must be logged in to reply to this topic.