This topic contains 5 replies, has 2 voices, and was last updated by  Steve 3 months ago.

  • Author
    Posts
  • #9254

    nahoma12
    Participant

    hi, i am new using piklist and i create cpt called organization and i create fields inside
    <?php
    /*
    Title: organization CPT
    Post Type: organizations
    Taxonomy: gt_org_taxonomy, gt_org_city_taxonomy
    Context: normal
    Priority: high

    */

    piklist(‘field’, array(
    ‘type’ => ‘select’
    ,’title’ => ‘Rooms’
    ,’choices’ => piklist(get_posts(array(
    ‘numberposts’ => -1
    ,’post_type’ => ‘rooms’
    )), array(‘ID’, ‘post_title’))
    ,’relate’ => array(
    ‘scope’ => ‘post’
    )
    ,’attributes’ => array(
    ‘multiple’ => ‘multiple’
    )
    ));

    piklist(‘field’, array(
    ‘type’ => ‘file’
    ,’field’ => ‘feature_image’
    ,’scope’ => ‘post_meta’
    ,’label’ => ‘Feature image’
    ,’options’ => array(
    ‘basic’ => true
    )
    ));
    piklist(‘field’, array(
    ‘type’ => ‘textarea’,
    ‘field’ => ‘my_description’,
    ‘label’ => ‘Description’,
    ‘attributes’ => array(
    ‘rows’ => 10,
    ‘cols’ => 50,
    ‘class’ => ‘large-text’
    )
    ));
    .
    .
    .
    .
    while i try to add data on cpt fields its not normal

    it may be in edit mood but how can i change normal page?

    i expect this org cpt.png
    problem is this both screen shoot

    if you have any idea please help me ..thanks.

    Attachments:
    You must be logged in to view attached files.
  • #9258

    Steve
    Keymaster

    @nahoma12– Welcome to the Piklist community!

    Based on the screenshots, your custom CPT is using Gutenberg, which Piklist does not support.

    To change your CPT to the classic editor, when you register your post type:
    -set show_in_rest to false.
    -make sure the supports array doesn’t include editor

    If you’re confused feel free to post the code you used to register your post type and we’ll fix it up for you.

  • #9259

    nahoma12
    Participant

    hi steve thanks for your fast response, classic editor working and i add taxonomy, i want select list type of taxonomy, but it don’t work. here is the code.

    add_filter('piklist_taxonomies', 'org_type_taxonomy');
      function org_type_taxonomy($taxonomies) {
         $taxonomies[] = array(
            'post_type' => 'organizations'
          ,'name' => 'orgtype'
          ,'show_admin_column' => true
          ,'configuration' => array(
            'hierarchical' => true
            ,'labels' => piklist('taxonomy_labels', 'orgtype')
            ,'hide_meta_box' => false
            ,'show_ui' => true
            ,'query_var' => true
              )
          );
        return $taxonomies;
      }

    i add this on the custom plugin php file

    <?php
    /*
    Title: taxonomy for my org cpt
    Description: type of org 
    Taxonomy: orgtype
    
    */
    piklist('field', array(
      'type' => 'select'
      ,'scope' => 'taxonomy'
      ,'field' => 'orgtype'
      ,'label' => 'Org Type'
      ,'description' => 'Terms will appear when they are added to this taxonomy.'
      ,'choices' => array(
          '' => 'Choose Term'
        )
       + piklist(get_terms('org_type_taxonomy', array(
          'hide_empty' => false
        ))
        ,array(
          'term_id'
          ,'name'
        )
      )
    ));

    i add this on the part/setting/taxonomy.php

    but i doesn’t work i try with out the taxonomy.php and with taxonomy.php same out came (check box taxonomy) , i think my custom plugin .php is not reading my taxonomy.php or some code error.

    and where to add this code

    function my_register_taxonomy_for_cpts()
    {
    
      register_taxonomy_for_post_type('orgtype', 'post');
    }
    add_action('init', 'my_register_taxonomy_for_cpts');

    please help me

    Attachments:
    You must be logged in to view attached files.
  • #9261

    nahoma12
    Participant

    one thing i want to add is…. i have field in my organization cpt called price and i want it number field with currency like (usd, etb, ..) how can i do it?

    Attachments:
    You must be logged in to view attached files.
  • #9264

    nahoma12
    Participant

    PLEASE i am waiting the answer ..please!!!

  • #9265

    Steve
    Keymaster

    I’m not following this. Please zip up your plugin and email to [email protected]

You must be logged in to reply to this topic.