Sortable Function isn’t working for Groups
-
Hi,
This a really great plugin that helps us a lot in our work!
But we have a problem where the Sortable Function for groups isn’t working. Even after saving the Page as noted as a solution here: https://github.com/WebDevStudios/CMB2/issues/692
We are using the following plugins:
- https://github.com/WebDevStudios/CMB2-Snippet-Library/blob/master/javascript/cmb2-js-validation-required.php
- https://github.com/WebDevStudios/cmb2-attached-posts
- https://github.com/jcchavezs/cmb2-conditionals
- https://github.com/mustardBees/cmb_field_map
Here is the code for the field:
/** * Repeatable Field Groups * * SIDL?NKAR */ $cmb_group = new_cmb2_box( array( 'id' => $prefix . 'subfeatured_links_metabox', 'title' => __( 'Bassidor', 'cmb2' ), 'context' => 'after_title', 'object_types' => array( 'page' ), 'show_on' => array( 'key' => 'page-template', 'value' => array( 'template-landing.php', 'template-poi.php' ) ), ) ); // $group_field_id is the field id string, so in this case: $prefix . 'demo' $group_field_id = $cmb_group->add_field( array( 'id' => $prefix . 'subfeatured_content', 'type' => 'group', 'description' => __( 'Bassidor visas i kolumner l?ngst ned p? Landningssidan med Rubrik, Ingress och L?nk.', 'cmb2' ), 'options' => array( 'group_title' => __( 'Bassida {#}', 'cmb2' ), // {#} gets replaced by row number 'add_button' => __( 'L?gg till Bassida', 'cmb2' ), 'remove_button' => __( 'Ta bort Bassida', 'cmb2' ), 'sortable' => true, // beta 'closed' => false, // true to have the groups closed by default ), ) ); /** * Group fields works the same, except ids only need * to be unique to the group. Prefix is not needed. * * The parent field's id needs to be passed as the first argument. */ $cmb_group->add_group_field( $group_field_id, array( 'name' => __( 'Bassida', 'cmb2' ), 'desc' => __( 'V?lj bassida att visa. Rubrik, Ingress och L?nk h?mtas automatiskt.', 'cmb2' ), 'id' => 'attached_cmb2_attached_posts', 'type' => 'custom_attached_posts', 'options' => array( 'show_thumbnails' => true, // Show thumbnails on the left 'filter_boxes' => false, // Show a text box for filtering the results 'query_args' => array( 'post_type'=>array( 'page'), 'posts_per_page' => -1, 'post_parent' => $_GET['post'] ), // override the get_posts args 'max_attached' => true ), ) ); $cmb_group->add_group_field( $group_field_id, array( 'name' => 'Anpassa', 'id' => 'custom_content_checkbox', 'type' => 'checkbox', 'description' => 'Kryssa i denna ruta f?r att anpassa: Rubrik, Ingress, L?nk och/eller L?nktext. OBS! Kryssa ?ven i denna rutan om du vill l?nka till n?got som inte ?r en undersida.' ) ); $cmb_group->add_group_field( $group_field_id, array( 'name' => __( 'Anpassad rubrik', 'cmb2' ), 'id' => 'heading', 'type' => 'text', 'attributes' => array( 'data-conditional-id' => wp_json_encode( array( $group_field_id, 'custom_content_checkbox' ) ), 'data-conditional-value' => 'on', ), ) ); $cmb_group->add_group_field( $group_field_id, array( 'name' => __( 'Anpassad ingress', 'cmb2' ), //'description' => __( '', 'cmb2' ), 'id' => 'content', 'type' => 'textarea_small', 'attributes' => array( 'data-conditional-id' => wp_json_encode( array( $group_field_id, 'custom_content_checkbox' ) ), 'data-conditional-value' => 'on', ), ) ); $cmb_group->add_group_field( $group_field_id, array( 'name' => __( 'Anpassad l?nk', 'cmb2' ), 'id' => 'link_picked', 'type' => 'link_picker', 'attributes' => array( 'data-conditional-id' => wp_json_encode( array( $group_field_id, 'custom_content_checkbox' ) ), 'data-conditional-value' => 'on', ), ) );
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Sortable Function isn’t working for Groups’ is closed to new replies.