Viewing 16 reply threads
  • Author
    Posts
    • #1856
      msmith
      Member

      I have been working on my first plugin with Piklist, using both the Tutorials and the Demos as examples. I have been able to create a custom post type, along with a meta box with additional fields. From how I understand, in the header of the meta box I included Post Type: member, but when I go and look at the edit page, I can only see the title box, not my meta box.

      Please advise where I am going wrong.

    • #1859
      Steve
      Keymaster

      @msmith– Please post the full meta box code.

    • #1860
      msmith
      Member

      Sure. I have it below.

      <?php
      /*
      Title: Application Data
      Description: Data from membership application.
      Post Type: member
      */
         piklist('field', array(
          'type' => 'group'
          ,'label' => 'Address'
          //,'description' => 'An Un-grouped field. Data is saved as individual meta and is searchable.'
          ,'fields' => array(
            array(
              'type' => 'text'
              ,'field' => 'ungrouped_address_1'
              ,'label' => 'Street Address'
              ,'columns' => 12
            )
            ,array(
              'type' => 'text'
              ,'field' => 'ungrouped_address_2'
              ,'label' => 'PO Box, Suite, etc.'
              ,'columns' => 12
            )
            ,array(
              'type' => 'text'
              ,'field' => 'ungrouped_city'
              ,'label' => 'City'
              ,'columns' => 5
            )
            ,array(
              'type' => 'select'
              ,'field' => 'ungrouped_state'
              ,'label' => 'State'
              ,'columns' => 4
              ,'choices' => array(
                'AL' => 'Alabama'
                ,'AK' => 'Alaska'  
                ,'AZ' => 'Arizona'  
                ,'AR' => 'Arkansas'  
                ,'CA' => 'California'  
                ,'CO' => 'Colorado'  
                ,'CT' => 'Connecticut'  
                ,'DE' => 'Delaware'  
                ,'DC' => 'District Of Columbia'  
                ,'FL' => 'Florida'  
                ,'GA' => 'Georgia'  
                ,'HI' => 'Hawaii'  
                ,'ID' => 'Idaho'  
                ,'IL' => 'Illinois'  
                ,'IN' => 'Indiana'  
                ,'IA' => 'Iowa'  
                ,'KS' => 'Kansas'  
                ,'KY' => 'Kentucky'  
                ,'LA' => 'Louisiana'  
                ,'ME' => 'Maine'  
                ,'MD' => 'Maryland'  
                ,'MA' => 'Massachusetts'  
                ,'MI' => 'Michigan'  
                ,'MN' => 'Minnesota'  
                ,'MS' => 'Mississippi'  
                ,'MO' => 'Missouri'  
                ,'MT' => 'Montana'
                ,'NE' => 'Nebraska'
                ,'NV' => 'Nevada'
                ,'NH' => 'New Hampshire'
                ,'NJ' => 'New Jersey'
                ,'NM' => 'New Mexico'
                ,'NY' => 'New York'
                ,'NC' => 'North Carolina'
                ,'ND' => 'North Dakota'
                ,'OH' => 'Ohio'  
                ,'OK' => 'Oklahoma'  
                ,'OR' => 'Oregon'  
                ,'PA' => 'Pennsylvania'  
                ,'RI' => 'Rhode Island'  
                ,'SC' => 'South Carolina'  
                ,'SD' => 'South Dakota'
                ,'TN' => 'Tennessee'  
                ,'TX' => 'Texas'  
                ,'UT' => 'Utah'  
                ,'VT' => 'Vermont'  
                ,'VA' => 'Virginia'  
                ,'WA' => 'Washington'  
                ,'WV' => 'West Virginia'  
                ,'WI' => 'Wisconsin'  
                ,'WY' => 'Wyoming'
              )
            )
            ,array(
              'type' => 'text'
              ,'field' => 'ungrouped_postal_code'
              ,'label' => 'Postal Code'
              ,'columns' => 3
            )
          )
        ));
      
        piklist('field', array(
          'type' => 'text'
      	,'field' => 'member_phone_number'
          ,'label' => 'Phone Number'
        ));
      
       
       piklist('field', array(
      	'type' => 'text'
      	,'field' => 'member_email'
      	,'label' => 'member_phone'
      	)
        );
      
       /* piklist('shared/code-locater', array(
          'location' => __FILE__
          ,'type' => 'Meta Box'
        ));*/
        
      ?>

      Thanks for your help
      Michael

    • #1861
      Steve
      Keymaster

      Did you try enabling wp_debug? Guessing there is a syntax error somewhere.

    • #1865
      msmith
      Member

      I just enabled wp_debug, but not seeing any messages when I go to the add screen.

    • #1866
      Steve
      Keymaster

      Please post the code for creating your post type.

    • #1867
      Steve
      Keymaster

      Please post the code for creating your post type.

    • #1868
      msmith
      Member
      add_filter('piklist_post_types', 'members_post_types');
        function members_post_types($post_types)
        {
          $post_types['members'] = array(
            'labels' => piklist('post_type_labels', 'Members')
            ,'title' => __('Add a new Member')
            //,'menu_icon' => piklist_admin::responsive_admin() == true ? plugins_url('piklist/parts/img/piklist-icon.svg') : plugins_url('piklist/parts/img/piklist-icon.png') 
            //,'page_icon' => plugins_url('piklist/parts/img/piklist-page-icon-32.png')
            ,'supports' => array(
              'title',
              'revisions',
            )
            ,'public' => true
            
            ,'has_archive' => true
            ,'rewrite' => array(
              'slug' => 'member'
            )
           // ,'capability_type' => 'post'
            ,'edit_columns' => array(
              'title' => __('Member')
              //,'author' => __('Assigned to')
      		,'post_states' => __('Status')
            )
            ,'hide_meta_box' => array(
              'slug'
              ,'author'
            )
            ,'post_states' => true
            ,'status' => array(
              'draft' => array(
                'label' => 'Inactive'
                ,'public' => true
              )
              ,'active' => array(
                'label' => 'Active'
                ,'public' => true
              )
            )
          );
          
          return $post_types;
        }

      Thanks for your help
      Michael

    • #1869
      Steve
      Keymaster

      You registered the post type members ( plural), but the comment block is set to member (singular). They need to match.

    • #1870
      msmith
      Member

      I have made them match (now they are all members) but it’s still not showing. Is there something else I might need to correct?

    • #1871
      Steve
      Keymaster
    • #1872
      msmith
      Member

      I just went through and everything has t he correct structure.

    • #1873
      Steve
      Keymaster

      If you want to zip up the plugin/theme and email to [email protected], we can take a look.

    • #1874
      msmith
      Member

      I just sent the email.

      Michael

    • #1875
      Steve
      Keymaster

      @msmith

      Got your email and zip. You just need to add: Plugin Type: Piklist to the comment block of your main plugin file, in your case members.php. The full tutorial is here >

      Let me know if you still have issues, but it’s working fine for me.

    • #1876
      msmith
      Member

      Thanks for your help. I thought I went back and checked that, but apparently not.

    • #1880
      Steve
      Keymaster

      Awesome! Glad you love Piklist. Let us know if you need help with anything else.

Viewing 16 reply threads
  • The topic ‘Meta Box Not Showing’ is closed to new replies.