• Resolved a4jp

    (@a4jpcom)


    Please sort the dynamic checkboxes by slugs as kanji is sorted by the JIS numbers making lists random as well as other languages. This is really bad. Slugs also offer control as we can type in anything we like as a URL when we need to fix the order of things. Each category gets a set ID and as this doesn’t change it so should be used for CSS referencing. Your dynamic checkboxes are now in lists (li) with out classes. Can you reference them with a page ID class? They will need to have a letter at the beginning of the class as they can’t just use numbers as class names. Maybe something like wpf-1 would be nice as it’s short but it refers to your plugin name. Hope you can fix the main problem of sorting dynamic checkboxes as soon as possible. An almost randomized list of almost 5,000 to 7,000 kanji characters is no good why trying to find stuff.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Prashant Rai

    (@prashantrai)

    Hey @a4jpcom – Thanks for contacting us!

    Let me check with the team, and I’ll circle back with more details soon. In the meantime, if you have any questions, please feel free to reach out.

    Kindly,

    Prashant Rai

    (@prashantrai)

    Hey @a4jpcom – Thanks for the patience. I had a chat with the team and to help you better when you have sometime, can you please share an example URL and more details on what you’re trying to accomplish?

    Kindly,

    Hey @a4jpcom – We haven’t heard back from you in about 3 days, so I’m going to go ahead and close this thread for now. But if you’d like us to assist further, please feel welcome to continue the conversation.

    Thanks!

    Thread Starter a4jp

    (@a4jpcom)

    I was working. Please give me a link to a sample with dynamic checkboxes.

    Hey @a4jpcom – Thanks for following this ticket!

    I see you’ve posted some additional details on another thread. We currently have an open request with the developers and they’re looking into this. I’ll also share your feedback with the developers, and when an update is released, I’ll be sure to circle back to notify you.

    In the meantime, if you have any questions, please feel free to reach out.

    Kindly,

    • This reply was modified 1 year, 11 months ago by Prashant Rai.
    Thread Starter a4jp

    (@a4jpcom)

    Can you check what is happening please? It is still almost impossible to organize large dynamic lists of checkboxes with kanji (Japanese) because the class code hasn’t been updated yet. A super simple fix. I even sent the code to fix the problem before. English and katakana works but it is very important to allow kanji to be sorted properly.

    Thread Starter a4jp

    (@a4jpcom)

    There just needs to be a way to sort the dynamic checkboxes by slugs. Even if it’s an option.

    • This reply was modified 1 year, 11 months ago by a4jp.

    Hey @a4jpcom – Our developers have shared this code snippet that you can consider using:

    /**
     * Add custom CSS classnames to dynamic choices.
     *
     * @param array $properties Properties for rendering the field on the frontend.
     * @param array $field      Original field data.
     * @param array $form_data  Form data.
     *
     * @return array
     */
    function wpforms_add_dynamic_choices_ids( $properties, $field, $form_data ) {
    
    	// Exit early if Dynamic Choices is not enabled.
    	if ( empty( $field['dynamic_choices'] ) ) {
    		return $properties;
    	}
    
    	// Get the prefix (post, page, category, post_tag, your_custom_post_type, your_custom_taxonomy).
    	$prefix = $field[ 'dynamic_' . $field['dynamic_choices'] ];
    
    	// Loop through all choices.
    	foreach ( $properties['inputs'] as $index => $input ) {
    		// Combine dynamic prefix with the real item (post, category etc) ID.
    		$class_name = $prefix . '-' . $input['attr']['value'];
    		// Add to list of choice item container classes.
    		$properties['inputs'][ $index ]['container']['class'][] = $class_name;
    	}
    
    	return $properties;
    }
    add_filter( 'wpforms_field_properties_checkbox', 'wpforms_add_dynamic_choices_ids', 10, 3 );
    add_filter( 'wpforms_field_properties_radio', 'wpforms_add_dynamic_choices_ids', 10, 3 );

    The above code works with all built-in post types and taxonomies, as well as any public custom post types and taxonomies, produces classnames as:

    post-123
    page-123
    book-123
    category-123
    post_tag-123
    genre-123

    In case it helps, here’s our tutorial with the most common ways to add custom code like this.

    For the most beginner-friendly option in that tutorial, I’d recommend using the Code Snippets plugin.

    Kindly,

    • This reply was modified 1 year, 11 months ago by Prashant Rai.

    Hey @a4jpcom

    We haven’t heard back from you in a few days, so I’m going to go ahead and close this thread for now. But if you’d like us to assist further, please feel welcome to continue the conversation.

    Thanks!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘There is a huge problem with the sorting of the dynamic checkboxes’ is closed to new replies.