Forum Replies Created

Viewing 15 posts - 1 through 15 (of 34 total)
  • Author
    Posts
  • in reply to: piklist Gutenberg compatibility #9345
    hozefasmile
    Member

    Hi,

    Is there any posibility to create custom blocks with our desired fields and templates to be used in gutenberg ?

    Thanks
    Hozefa

    in reply to: Issues in latest version #9263
    hozefasmile
    Member

    Hi All,

    I am also facing this issue when tried to create a second widget with piklist.

    I am creating a site where I have created custom widget for navigation menu and recent post. After creating the second widget it shows and error message “Warning: Invalid argument supplied for foreach() in /myserverpath/wp-content/plugins/piklist/parts/shared/widget-select.php on line 67” , though its not showing on front end and there is no any serious issue, but there might be some coding issue in file “widget-select.php”

    But I found that if we create form file for each widget, (in my case I hadn’t created for recet post wdiget, as I don’t need any input) , the error get disappear itself.

    Just informing here because I think this post is related with this error.

    in reply to: Custom Fields in User Profile #7799
    hozefasmile
    Member

    Hi Steve,

    I have tried to add a new field for user profile. Created a folder in my theme piklist/parts/users/ and then created a file uniqueuserprofile.php and added this code

    <?php
    /*
    Title: Patient Information
    */
    
    piklist('field', array(
        'type' => 'text'
        ,'field' => 'user_address'
        ,'label' => 'Address'
        ,'attributes' => array(
          'class' => 'text'
        )
      ));
    ?>

    But no new field in showing in user profile page during creation of a new user. It though show when the user has already been created. But how can we show the custom field during a new user creation ?

    in reply to: shortcode output #7785
    hozefasmile
    Member

    @morganrt, I have seen that keeping html separate from php code for output of shortcode causes sometime issue. So keeping the html also within the php code will be better.

    For example for displaying a bootstrap button I have created this form file

    <?php
    /*
    Name: Button Primary
    shortcode: button_primary
    icon: dashicons-tickets-alt
    editor: true
    */
    
    piklist('field', array(
        'type' => 'text',
        'field' => 'button_url',
        'label' => 'Link url for Button',
        'attributes' => array(
          'class' => 'regular-text' // WordPress css class 
        )
      ));
    piklist('field', array(
        'type' => 'text',
        'field' => 'button_text',
        'label' => 'Text to show in Button',
        'attributes' => array(
          'class' => 'regular-text' // WordPress css class 
        )
      ));
    piklist('field', array(
        'type' => 'select',
        'field' => 'button_type',
        'label' => 'Select Button Type',
        'choices' => array(
          'btn-primary' => 'Primary Color',
          'btn-info' => 'Light Blue',
          'btn-danger' => 'Red'
        )
      ));
    ?>

    and then created the shortcode file like this

    <?php
    /*
    shortcode: button_primary
    */
    
    echo '<a href="' . $button_url . '" class="btn ' . $button_type . '">' . $button_text . '</a>' ;
    
    ?>
    

    This way it not cause any issue in display to front end. But if you try to keep it separate in html something like this it will cause error and not display your content in frontend.

    <?php
    /*
    shortcode: button_primary
    */
    ?>
    <a href="<?php echo $button_url; ?>" class="btn <?php echo $button_type; ?>"><?php echo $button_text; ?></a>
    hozefasmile
    Member

    Hi Steve,

    I have changed the field value to ‘book_category’ , the taxonomy created, but still the result is same, no taxonomy being saved.
    Now my category choosing field looks like this:-

    piklist('field', array(
        'type'        => 'select'
        ,'scope'       => 'taxonomy'
        ,'field'       => 'book_category'
        ,'choices' => piklist(get_terms('book_category', array(
                'hide_empty' => false
            )), array(
                'term_id'
                ,'name'
            )
        )
        ,'required' => true,
    ));

    , but still not working 🙁

    hozefasmile
    Member

    Hi @Steve,

    Do you have any idea why my post category are not saving for this form? http://uniquesweb.co.in/piklist/submit-book/
    I have used this field in frontend form file

    piklist('field', array(
    
        'type'        => 'select'
    
        ,'scope'       => 'taxonomy'
    
        ,'field'       => 'book_type'
    
        ,'choices' => piklist(get_terms('book_category', array(
    
                'hide_empty' => false
    
            )), array(
    
                'term_id'
    
                ,'name'
    
            )
    
        )
    
        ,'required' => true,
    
    ));

    and this is how my custom post type and custom taxonomy is created in theme’s function.php file

    function create_book_custom_post_type() {
    
    	$labels = array(
    		'name'                  => _x( 'Books', 'Post Type General Name', 'bootstrap-basic' ),
    		'singular_name'         => _x( 'Book', 'Post Type Singular Name', 'bootstrap-basic' ),
    		'menu_name'             => __( 'Books', 'bootstrap-basic' ),
    		'name_admin_bar'        => __( 'Book', 'bootstrap-basic' ),
    		'archives'              => __( 'Book Archives', 'bootstrap-basic' ),
    		'attributes'            => __( 'Book Attributes', 'bootstrap-basic' ),
    		'parent_item_colon'     => __( 'Parent Book:', 'bootstrap-basic' ),
    		'all_items'             => __( 'All Books', 'bootstrap-basic' ),
    		'add_new_item'          => __( 'Add New Book', 'bootstrap-basic' ),
    		'add_new'               => __( 'Add New', 'bootstrap-basic' ),
    		'new_item'              => __( 'New Book', 'bootstrap-basic' ),
    		'edit_item'             => __( 'Edit Book', 'bootstrap-basic' ),
    		'update_item'           => __( 'Update Book', 'bootstrap-basic' ),
    		'view_item'             => __( 'View Book', 'bootstrap-basic' ),
    		'view_items'            => __( 'View Books', 'bootstrap-basic' ),
    		'search_items'          => __( 'Search Book', 'bootstrap-basic' ),
    		'not_found'             => __( 'Not found', 'bootstrap-basic' ),
    		'not_found_in_trash'    => __( 'Not found in Trash', 'bootstrap-basic' ),
    		'featured_image'        => __( 'Featured Image', 'bootstrap-basic' ),
    		'set_featured_image'    => __( 'Set featured image', 'bootstrap-basic' ),
    		'remove_featured_image' => __( 'Remove featured image', 'bootstrap-basic' ),
    		'use_featured_image'    => __( 'Use as featured image', 'bootstrap-basic' ),
    		'insert_into_item'      => __( 'Insert into Book', 'bootstrap-basic' ),
    		'uploaded_to_this_item' => __( 'Uploaded to this Book', 'bootstrap-basic' ),
    		'items_list'            => __( 'Books list', 'bootstrap-basic' ),
    		'items_list_navigation' => __( 'Books list navigation', 'bootstrap-basic' ),
    		'filter_items_list'     => __( 'Filter Books list', 'bootstrap-basic' ),
    	);
    	$rewrite = array(
    		'slug'                  => 'book',
    		'with_front'            => true,
    		'pages'                 => true,
    		'feeds'                 => true,
    	);
    	$args = array(
    		'label'                 => __( 'Book', 'bootstrap-basic' ),
    		'labels'                => $labels,
    		'supports'              => array( 'title', 'excerpt', 'author', 'thumbnail', 'revisions', ),
    		'taxonomies'            => array( 'book_category' ),
    		'hierarchical'          => false,
    		'public'                => true,
    		'show_ui'               => true,
    		'show_in_menu'          => true,
    		'menu_position'         => 25,
    		'menu_icon'             => 'dashicons-format-aside',
    		'show_in_admin_bar'     => true,
    		'show_in_nav_menus'     => true,
    		'can_export'            => true,
    		'has_archive'           => 'books',
    		'exclude_from_search'   => false,
    		'publicly_queryable'    => true,
    		'rewrite'               => $rewrite,
    		'capability_type'       => 'post',
    	);
    	register_post_type( 'book', $args );
    
    }
    add_action( 'init', 'create_book_custom_post_type', 0 );
    function create_book_custom_taxonomy() {
    
    	$labels = array(
    		'name'                       => _x( 'Book Categories', 'Taxonomy General Name', 'bootstrap-basic' ),
    		'singular_name'              => _x( 'Book Category', 'Taxonomy Singular Name', 'bootstrap-basic' ),
    		'menu_name'                  => __( 'Book Category', 'bootstrap-basic' ),
    		'all_items'                  => __( 'All Book Categories', 'bootstrap-basic' ),
    		'parent_item'                => __( 'Parent Book Category', 'bootstrap-basic' ),
    		'parent_item_colon'          => __( 'Parent Book Category:', 'bootstrap-basic' ),
    		'new_item_name'              => __( 'New Book Category Name', 'bootstrap-basic' ),
    		'add_new_item'               => __( 'Add New Book Category', 'bootstrap-basic' ),
    		'edit_item'                  => __( 'Edit Book Category', 'bootstrap-basic' ),
    		'update_item'                => __( 'Update Book Category', 'bootstrap-basic' ),
    		'view_item'                  => __( 'View Book Category', 'bootstrap-basic' ),
    		'separate_items_with_commas' => __( 'Separate items with commas', 'bootstrap-basic' ),
    		'add_or_remove_items'        => __( 'Add or remove Book Categories', 'bootstrap-basic' ),
    		'choose_from_most_used'      => __( 'Choose from the most used', 'bootstrap-basic' ),
    		'popular_items'              => __( 'Popular Book Categories', 'bootstrap-basic' ),
    		'search_items'               => __( 'Search Book Categories', 'bootstrap-basic' ),
    		'not_found'                  => __( 'Not Found', 'bootstrap-basic' ),
    		'no_terms'                   => __( 'No Book Categories', 'bootstrap-basic' ),
    		'items_list'                 => __( 'Book Categories list', 'bootstrap-basic' ),
    		'items_list_navigation'      => __( 'Book Categories list navigation', 'bootstrap-basic' ),
    	);
    	$rewrite = array(
    		'slug'                       => 'book_category',
    		'with_front'                 => true,
    		'hierarchical'               => false,
    	);
    	$args = array(
    		'labels'                     => $labels,
    		'hierarchical'               => true,
    		'public'                     => true,
    		'show_ui'                    => true,
    		'show_admin_column'          => true,
    		'show_in_nav_menus'          => true,
    		'show_tagcloud'              => true,
    		'rewrite'                    => $rewrite,
    	);
    	register_taxonomy( 'book_category', array( 'book' ), $args );
    
    }
    add_action( 'init', 'create_book_custom_taxonomy', 0 );

    All other fields are saving correctly in their place for the custom post type book, only the category that I choose in front end form doesn’t work and remains unselected for the post in wp-admin.

    Please help where I am doing wrong?

    in reply to: Front End Form Taxonomy Not Saving #7641
    hozefasmile
    Member

    Ok I have corrected it, it was some code mistake. So now the form is showing and all fields are also working perfect. All data is saving correctly in custom post. The only problem is with taxonomy. Whatever category you choose in the frontend form, its not saving in that category and checking in backend it shows blank in category field.

    My codes here again for the category in form php file

    // post category
     piklist('field', array(
        'type'        => 'select'
        ,'scope'       => 'taxonomy'
        ,'field'       => 'book_type'
        ,'choices' => piklist(get_terms('book_type', array(
                'hide_empty' => false
            )), array(
                'term_id'
                ,'name'
            )
        )
        ,'required' => true,
    ));

    In my theme function file this way the custom post type and custom taxonomy has been created

    /* Registering new post type */
    add_filter('piklist_post_types', 'book_post_type');
    function book_post_type($post_types)
    {
      $post_types['book'] = array(
        'labels' => piklist('post_type_labels', 'Book')
        ,'public' => true
        ,'rewrite' => array(
          'slug' => 'book'
        )
        ,'supports' => array(
          'author'
          ,'title'
          ,'excerpt'
          ,'revisions'
          ,'thumbnail'
        )
        ,'hide_meta_box' => array(
          'slug'
          ,'author'
          ,'revisions'
          ,'comments'
          ,'commentstatus'
        )
      );
     
      return $post_types;
    }
    /* adding custom taxonomy */
    add_filter('piklist_taxonomies', 'book_type_tax');
     function book_type_tax($taxonomies)
     {
       $taxonomies[] = array(
          'post_type' => 'book'
          ,'name' => 'book_type'
          ,'show_admin_column' => true
          ,'configuration' => array(
            'hierarchical' => true
            ,'labels' => piklist('taxonomy_labels', 'Book Type')
            ,'hide_meta_box' => true
            ,'show_ui' => true
            ,'query_var' => true
            ,'rewrite' => array( 
              'slug' => 'book-type' 
            )
          )
        );
    return $taxonomies;
    }

    So not sure where is the issue or what changes need to bee done so that taxonomy fields selected in frontend saves the category for the newly submitted post.

    in reply to: Front End Form Taxonomy Not Saving #7640
    hozefasmile
    Member

    Is the frontend form is supported in version 0.9.9.9 ? or its is available in only beta version?

    I am trying to create this form for my custom post type book:-

    
    <?php
    /*
    Title: Book Submit
    Method: post
    Message: Data will be saved as new book.
    Logged in: true
    */
    
    // Where to save this form
      piklist('field', array(
        'type' => 'hidden'
        ,'scope' => 'post'
        ,'field' => 'post_type'
        ,'value' => 'book'
      ));
    // Post Status on submit
      piklist('field', array(
      	'type' => 'hidden'
      	,'scope' => 'post'
      	,'field' => 'post_status'
      	,'value' => 'publish'
      ));
      
      piklist('field', array(
        'type' => 'text'
        ,'scope' => 'post' // post_title is in the wp_posts table, so scope is: post
        ,'field' => 'post_title'
        ,'label' => 'Book Title'
        ,'attributes' => array(
          'wrapper_class' => 'post_title'
          ,'style' => 'width: 100%'
        )
      ));
      
      // post category
      piklist('field', array(
        'type'        => 'select',
        'scope'       => 'taxonomy',
        'field'       => 'book_type',
        'choices' => piklist(get_terms('book_type', array(
                'hide_empty' => false,
            )), array(
                'term_id',
                'name',
            )
        ),
        'required' => true,
    ));
    
    // featured image
    piklist('field', array(
      'type'        => 'file'
      ,'scope'       => 'post_meta'
      ,'field'       => '_thumbnail_id'
      ,'label'       => 'Featured Image'
      ,'options'     => array(
        'modal_title' => 'Add File(s)'
        ,'button'      => 'Add'
      )
      ,'validate' => array(
        array(
          'type'    => 'limit'
          ,'options' => array(
            'min'     => 1
            ,'max'     => 1
          )
        )
        ,array(
          'type' => 'image'
        )
      )
    ));
      
      piklist('field', array(
      	'type' => 'textarea'
      	,'scope' => 'post'
      	,'field' => 'post_excerpt'
      	,'label' => 'About Book'
      	,'attributes' => array(
      		'rows' => 10
      		,'cols' => 30
      		,'class' => 'large-text'
      	)
      ));
      
      
    
    piklist('field', array(
      'type' => 'text'
      ,'scope' => 'post_meta'
      ,'field' => 'publisher_name'
      ,'label' => 'Publisher Name'
    ));
    
    piklist('field', array(
    	'type' => 'text'
    	,'scope' => 'post_meta'
    	,'field' => 'writer_name'
    	,'label' => 'Writer Name'
    ));
    piklist('field', array(
    	'type' => 'text'
    	,'scope' => 'post_meta'
    	,'field' => 'isbn_number'
    	,'label' => 'ISBN Number'
    	,'help' => 'Provide ISBN Number of the book'
    ));
    
    piklist('field', array(
        'type' => 'datepicker',
        ,'scope' => 'post_meta'
        'field' => 'my_date_field',
        'label' => 'Date',
        'value' => date('M d, Y', time()), // set default value
        'options' => array(
          'dateFormat' => 'M d, yy'
        )
      ));
    piklist('field', array(
    	'type' => 'group'
    	,'scope' => 'post_meta'
    	,'field' => 'editor_info'
    	,'label' => 'Editors Information'
    	,'list' => false
    	,'column' => 2
    	,'add_more' => true
    	,'fields' => array(
    		array(
    		'type' => 'text'
    		,'scope' => 'post_meta'
    		,'field' => 'editor_name'
    		,'label' => 'Editor Name'
    		,'columns' => 6
    		)
    		,array(
    		'type' => 'file'
    		,'scope' => 'post_meta'
    		,'field' =>'editor_image'
    		,'label' => 'Upload Image'
    		,'columns' => 6
    		,'options' => array(
    			'modal_title' => 'Add file'
    			,'button' => 'Upload'
    			)
    		)
    	)
    ));
    
    // Submit button
      piklist('field', array(
        'type' => 'submit'
        ,'field' => 'submit'
        ,'value' => 'Submit'
      ));
    

    tried to add shortcode [piklist_form form="book-frontend-form" add_on="theme"] on a page but its not working.

    in reply to: How to create my own custom field #7635
    hozefasmile
    Member

    Hi @Jason,

    Thanks for your simplified solution. But I am still eager to know how to create my custom field. In the tutorial at https://piklist.com/learn/doc/creating-your-own-fields/ , it is just mention that you create your file in /fields/ folder , whatever name you give to the file then can be used as a custom field type value, for example ‘type’ => ‘my-checkbox’

    But what to do with that file which I have created in folder /fields/ ? Can I just put a simple html input field there and then where should I put my css and js files? can I provide path there in same file? If yes then how? Do you have an example of practical use of creating a custom field ?

    Thanks again

    hozefasmile
    Member

    Hi Steve,

    Have you reviewed the product page http://uniqueswebsolution.com/clippingc/product/photo-retouching/ ?

    Please suggest me what we should do to get correct working upload field and getting array result. And I am really very interested to know how we can callback a already submitted form fields ? because I need to callback it to show the urls on particular order pages.

    Thanks
    Hozefa

    in reply to: How to display add more field in oder detail page of woocommerce #5291
    hozefasmile
    Member

    Hi,

    I have tried your code

    piklist('field', array(
        'type' => 'file'
        ,'scope' => 'post_meta' // scope needs to be set on EVERY field for front-end forms.
        ,'field' => 'upload_order_attch'
        ,'label' => 'Add File(s)'
        ,'description' => 'You can add image files or zip file with all images in it.'
        ,'add_more' => true
        ,'options' => array(
          'modal_title' => __('Add File(s)', 'piklist-demo')
          ,'button' => __('Add', 'piklist-demo')
          ,'basic' => true
        )
      ));

    in the order-form.php , but this distort the upload field in the front end. http://uniqueswebsolution.com/clippingc/product/photo-retouching/
    cliking plus button doesn’t create the new brows button.

    My previous code

    piklist('field', array(
        'type' => 'group'
        ,'field' => 'upload_order_attch'
        ,'label' => __('Upload your images') 
        ,'scope' => 'post_meta'
        ,'columns' => 12
        ,'add_more' => true
        ,'fields' => array(
          array(
            'type' => 'file'
            ,'field' => 'attch-single'
        	,'scope' => 'post_meta'
            ,'label' => __('Add File(s)','piklist')
        	,'description' => __('You can add image files or zip file with all images in it.','piklist')
        	,'options' => array(
          		'basic' => true
        		)
            )
          )
        )
      );

    was showing the add more upload field correctly.

    I also want to know how we can callback a already submitted form fields ?

    Thanks
    Hozefa

    hozefasmile
    Member

    Ok,

    I have added global $post on my code, but its just informing that its an array. How I can get the url value from it for each uploaded images?

    For testing purpose I have created a page http://uniqueswebsolution.com/clippingc/testing/ . You can see that the code

    $meta = get_post_custom($post->ID);
    echo "<p class='piklist-class'>".$meta."</p>";
    print_r($meta);

    result in an array like this
    Array ( [_edit_lock] => Array ( [0] => 1449342554:1 ) [_edit_last] => Array ( [0] => 1 ) [_wp_page_template] => Array ( [0] => page-faq.php ) [_wpb_vc_js_status] => Array ( [0] => false ) [_vc_post_settings] => Array ( [0] => a:2:{s:7:”vc_grid”;a:0:{}s:10:”vc_grid_id”;a:0:{}} ) [slide_template] => Array ( [0] => default ) [layout] => Array ( [0] => fullwidth ) [sidebar] => Array ( [0] => blog-sidebar ) [bg_rev_slider] => Array ( [0] => ) [banner_type] => Array ( [0] => ) [banner_width] => Array ( [0] => wide ) [layer_slider] => Array ( [0] => ) [rev_slider] => Array ( [0] => ) [banner] => Array ( [0] => ) [product_slider] => Array ( [0] => ) [portfolio_columns] => Array ( [0] => 4 ) [portfolio_cat] => Array ( [0] => 0 ) [faq_cat] => Array ( [0] => 0 ) [content_top] => Array ( [0] => ) [content_bottom] => Array ( [0] => ) )

    and the code

    global $post;
    $upload_orders = get_post_custom($post->ID, 'upload_order_attch', false);
    foreach ($upload_orders as $upload_order => $value)
    {
    print_r($value);
    }

    gives array result like this
    Array ( [0] => 1449342675:1 ) Array ( [0] => 1 ) Array ( [0] => page-faq.php ) Array ( [0] => false ) Array ( [0] => a:2:{s:7:”vc_grid”;a:0:{}s:10:”vc_grid_id”;a:0:{}} ) Array ( [0] => default ) Array ( [0] => fullwidth ) Array ( [0] => blog-sidebar ) Array ( [0] => ) Array ( [0] => ) Array ( [0] => wide ) Array ( [0] => ) Array ( [0] => ) Array ( [0] => ) Array ( [0] => ) Array ( [0] => 4 ) Array ( [0] => 0 ) Array ( [0] => 0 ) Array ( [0] => ) Array ( [0] => )

    But when I try
    get_post_meta in place of get_post_custom
    its shows blank , no result.

    I actually want the customer who is ordering a graphic design service using woocommerce, will be able to upload his images during the order process and then those images will be available in backend individual order pages and front end individual order pages as image link to download. So that the site owner knows what images he have work for the particular order, and then by backend order detail page, he can upload is prepared (edited) graphic work and in same way that will be available on the customer order detail page for download.

    Thanks
    Hozefa

    hozefasmile
    Member

    Hi I have checked $meta = get_post_custom($post->ID); , it shows Array as result.

    But the above code

    $upload_orders = get_post_meta($post->ID, 'upload_order_attch', false);
    				foreach ($upload_orders as $upload_order => $value)
    				{
    				  echo $value;
    				}

    Show error “Warning: Invalid argument supplied for foreach() in /home/uniqueswebsol/public_html/clippingc/wp-content/themes/clippingstar-child/woocommerce/order/order-details.php on line 26”

    hozefasmile
    Member

    Yes, that shows empty result.

    hozefasmile
    Member

    Hi Steve,

    I have applied your modification, but still its not showing on the related order detail page for example http://uniqueswebsolution.com/clippingc/my-account/view-order/60/

    I think during the file upload we have to click submit button to add those images, this refreshes page, so it not get connected to the order and just saved as a separate file. But if we can connect with the order post that is being created during the checkout process, then we can show up them in corresponding order detail page.

    Thanks

Viewing 15 posts - 1 through 15 (of 34 total)