Tagged: ,

Viewing 4 reply threads
  • Author
    Posts
    • #1569
      mooolen
      Member

      Hello,

      I have built a custom post type plugin using the following code.
      However, only the metabox shows up, the other standard element such as title and content do not. Can you shed some light?

      /wp-content/plugin/iin_profile.php

      `add_filter(‘piklist_post_types’, ‘iin_profile_post_type’);
      function iin_profile_post_type($post_types)
      {
      $post_types[‘iin_profile’] = array(
      ‘labels’ => piklist(‘post_type_labels’, ‘User Profile’)
      ,’title’ => __(‘Enter user full name here’)
      ,’public’ => true
      ,’rewrite’ => array(
      ‘slug’ => ‘iin_profile’
      )
      ,’supports’ => array(
      ‘author’
      ,’revisions’
      ,’post_states’ => true
      )
      ,’hide_meta_box’ => array(
      ‘slug’
      ,’wpseo_meta’
      ,’author’
      ,’revisions’
      ,’comments’
      ,’commentstatus’
      )
      );
      return $post_types;
      }

      
      
      /wp-content/plugins/iin_profile/iin_profile-metabox.php
      

      piklist(‘field’, array(
      ‘type’ => ‘text’
      ,’field’ => ‘text’
      ,’label’ => ‘Text Box’
      ,’description’ => ‘Field Description’
      ,’value’ => ‘Default text’
      ,’help’ => ‘This is help 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’
      )
      ));

    • #1570
      Steve
      Keymaster

      @mooolen

      In your register post type code, under “supports”, you need to add “title”. This is not default because you are already declaring the “supports” parameter. If you declare “supports”, then you are overriding all defaults.

    • #1572
      mooolen
      Member

      Yes, it works now. Thank you!
      Do you have the custom post type components configuration setting documented in your user guide?
      I have tried finding it in the user guide or I have missed it somewhere?

    • #1575
      Steve
      Keymaster

      @mooolen– Great. Glad it works now.

      The Custom Post Parameters that Piklist has added to register_post_type is documented here >. However, we don’t include the standard WordPress parameters, like supports, which is what you used.

    • #1580
      mooolen
      Member

      Ok, thanks you for your help!

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