Clone function not working
Support › MB Settings Page › Clone function not working
- This topic has 9 replies, 3 voices, and was last updated 8 years ago by
Webbio.
-
AuthorPosts
-
March 25, 2017 at 3:02 PM #5381
Webbio
ParticipantHi,
Clone function is working great in metaboxes which I've added to CPT, POSTS and PAGES. Now I've create a settings panel and the clone function isn't working there. I've created the following code:
$meta_boxes[] = array( 'id' => 'component_footer_variant_1_keurmerken', 'title' => __( 'Logo\'s', 'textdomain' ), 'settings_pages' => 'component_footer_variant_1', 'fields' => array ( array ( 'id' => 'logos_images_urls', 'type' => 'group', 'clone' => true, 'sort_clone' => true, 'fields' => array ( array ( 'id' => 'logo_keurmerk', 'type' => 'image_advanced', 'name' => 'Logo afbeelding', ), array ( 'id' => 'url_keurkmerk', 'type' => 'url', 'name' => 'URL', ), ), ), ), );
But when I hit the: 'Add more' button then it just shifts up. I've created a video of this --> https://screencast.com/t/qGdc0j0lN Even when I add a clone to one simple text field I'm getting the same result.
Please advice.
Thanks!
Regards,
Nick
March 27, 2017 at 8:51 AM #5389Anh Tran
KeymasterHi Nick,
Are you using the latest version of MB Settings Page? I've updated the extension a week ago with a fix for clone.
March 27, 2017 at 2:50 PM #5391Webbio
ParticipantThanks for your response. Yes I've installed the latest version of MB Settings Page but the problem still exists.
March 28, 2017 at 4:55 AM #5397Graphem
ParticipantI do have also problem with clone and group, all the fields in the group are readonly and disabled, seems it has todo with passing empty value to those properties.
March 28, 2017 at 9:05 AM #5403Anh Tran
KeymasterCan you please post your full code here? I tried with your code above and it still works for me. I guess there's a conflict somewhere that breaks the JavaScript (you might want to check the console, too).
March 28, 2017 at 2:02 PM #5409Webbio
ParticipantI got a javascript error indeed:
Uncaught ReferenceError: wpseoPostScraperL10n is not defined at A (wp-seo-post-scraper-450.min.js:1) at HTMLDocument.F (wp-seo-post-scraper-450.min.js:1) at i (load-scripts.php:2) at Object.fireWith [as resolveWith] (load-scripts.php:2) at Function.ready (load-scripts.php:2) at HTMLDocument.K (load-scripts.php:2) wp-seo-post-scraper-450.min.js:1
When disabling the plug-in: Meta Box for Yoast Seo it's gone. Strange thing because I didn't use an argument for that yoast plug-in in my settings.
March 29, 2017 at 10:26 AM #5423Anh Tran
KeymasterHmm, I will check the Yoast SEO JavaScript. It caused some issues in the past. Can you post your full code here so I can check closer?
March 29, 2017 at 3:04 PM #5428Webbio
Participant<?php /** * Each compononent can have two parts. A dynamic part (is different for every instance) and a static part (is the same for every instance). * Underneath this comment the STATIC parts of the component (if exists) are registered. Those settings are site-wide applied. * Make sure you always use an unique ID to prevent conflicting fields. * ID name convention: * Settings pages: type_name (example: component_header_variant_1 --> Type = component, Name = header_variant_1) * Meta boxes: type_name_groupname (example: component_header_variant_1_box_1 --> Type = component, Name = header_variant_1, Groupname = box_1) * Fields in metaboxes: type_name_groupname_fieldname (example: component_header_variant_1_box_1_logo_normal --> Type = component, Name = header_variant_1, Groupname = box_1, Fieldname = logo_normal) * --- START DYNAMIC COMPONENT PARTS --- */ // Registering setting pages add_filter( 'mb_settings_pages', 'admin_settings_pages' ); function admin_settings_pages( $settings_pages ) { // Register setting page: General $settings_pages[] = array( 'id' => 'general', 'option_name' => 'general_settings', 'menu_title' => __( 'Instellingen', 'textdomain' ), 'icon_url' => 'dashicons-layout', 'submenu_title' => __( 'Algemeen', 'textdomain' ), ); // Register setting page: Component header variant 1 $settings_pages[] = array( 'id' => 'component_header_variant_1', 'option_name' => 'component_options_header_variant_1', 'menu_title' => __( 'Header', 'textdomain' ), 'parent' => 'general', ); // Register setting page: Component footer variant 1 $settings_pages[] = array( 'id' => 'component_footer_variant_1', 'option_name' => 'component_options_footer_variant_1', 'menu_title' => __( 'Footer', 'textdomain' ), 'parent' => 'general', ); return $settings_pages; } // Meta boxes for client settings page where general components and content is managed which is not different per page add_filter( 'rwmb_meta_boxes', 'admin_options_register_meta_boxes' ); function admin_options_register_meta_boxes( $meta_boxes ) { $meta_boxes[] = array( 'id' => 'admin_options_general', 'title' => __( 'Algemeen', 'textdomain' ), 'settings_pages' => 'general', 'fields' => array( ), ); /* * Register meta box: Component header variant 1 */ $meta_boxes[] = array( 'id' => 'component_header_variant_1_box_1', 'title' => __( 'Header', 'textdomain' ), 'settings_pages' => 'component_header_variant_1', 'fields' => array( array( 'id' => 'component_header_variant_1_box_1_logo_normal', 'name' => __( 'Logo (normaal)', 'textdomain' ), 'tooltip' => 'Logo in kleur of zwart', 'type' => 'image_advanced', ), array( 'id' => 'component_header_variant_1_box_1_tel_number', 'name' => __( 'Telefoonnummer', 'rwmb' ), 'type' => 'text', 'placeholder' => '06 1234 5678', ), array( 'id' => 'component_header_variant_1_box_1_tel_number_landcode', 'name' => __( 'Telefoonnummer (inc. landcode)', 'rwmb' ), 'type' => 'text', 'placeholder' => '+31612345678', ), array ( 'id' => 'component_header_variant_1_box_1_menu_selection', 'name' => 'Selecteer menu', 'type' => 'select', 'placeholder' => 'Selecteer een menu', 'options' => get_registered_nav_menus(), 'tooltip' => 'Selecteer hier het menu wat als hoofdmenu moet worden weergegeven', 'tab' => 'block_4', ), array( 'id' => 'component_header_variant_1_box_1_header_image', 'name' => __( 'Header afbeelding', 'textdomain' ), 'tooltip' => 'Deze afbeelding wordt standaard geladen in deze header', 'type' => 'image_advanced', ), ), ); /* * Register meta box: Component footer variant 1 */ $meta_boxes[] = array( 'id' => 'component_footer_variant_1_box_1', 'title' => __( 'Footer - eerste rij', 'textdomain' ), 'settings_pages' => 'component_footer_variant_1', 'tabs' => array( 'block_1' => array( 'label' => __( 'Blok 1', 'rwmb' ), 'icon' => 'dashicons-tagcloud', ), 'block_2' => array( 'label' => __( 'Blok 2', 'rwmb' ), 'icon' => 'dashicons-tagcloud', ), 'block_3' => array( 'label' => __( 'Blok 3', 'rwmb' ), 'icon' => 'dashicons-tagcloud', ), 'block_4' => array( 'label' => __( 'Blok 4', 'rwmb' ), 'icon' => 'dashicons-tagcloud', ), ), 'fields' => array( array( 'name' => __( 'Logo (invert)', 'rwmb' ), 'tooltip' => 'Logo in wit', 'id' => 'component_footer_variant_1_box_1_logo_white', 'type' => 'image_advanced', 'tab' => 'block_1', ), array( 'name' => __( 'Titel blok 1', 'rwmb' ), 'id' => 'component_footer_variant_1_box_1_title_block_1', 'type' => 'text', 'tab' => 'block_2', ), array( 'name' => __( 'Adres en huisnummer', 'rwmb' ), 'id' => 'component_footer_variant_1_box_1_address', 'type' => 'text', 'tab' => 'block_2', ), array( 'name' => __( 'Postcode en plaats', 'rwmb' ), 'id' => 'component_footer_variant_1_box_1_postal_residence', 'type' => 'text', 'tab' => 'block_2', ), array( 'name' => __( 'Titel blok 2', 'rwmb' ), 'id' => 'component_footer_variant_1_box_1_title_block_2', 'type' => 'text', 'tab' => 'block_3', ), array( 'name' => __( 'Postbus', 'rwmb' ), 'id' => 'component_footer_variant_1_box_1_post_address', 'type' => 'text', 'tab' => 'block_3', ), array( 'name' => __( 'Postcode en plaats', 'rwmb' ), 'id' => 'component_footer_variant_1_box_1_post_address_postal', 'type' => 'text', 'tab' => 'block_3', ), array( 'name' => __( 'Titel blok 3', 'rwmb' ), 'id' => 'component_footer_variant_1_box_1_title_block_3', 'type' => 'text', 'tab' => 'block_4', ), array( 'name' => __( 'Telefoonnummer', 'rwmb' ), 'id' => 'component_footer_variant_1_box_1_tel_number', 'type' => 'text', 'tab' => 'block_4', 'placeholder' => '06 1234 5678', ), array( 'name' => __( 'Telefoonnummer (inc. landcode)', 'rwmb' ), 'id' => 'component_footer_variant_1_box_1_tel_number_landcode', 'type' => 'text', 'tab' => 'block_4', 'placeholder' => '+31612345678', ), array( 'name' => __( 'E-mailadres', 'rwmb' ), 'id' => 'component_footer_variant_1_box_1_email', 'type' => 'email', 'tab' => 'block_4', ), ), ); $meta_boxes[] = array( 'id' => 'component_footer_variant_1_box_2', 'title' => __( 'Footer - tweede rij', 'textdomain' ), 'settings_pages' => 'component_footer_variant_1', 'tabs' => array( 'block_1' => array( 'label' => __( 'Blok 1', 'rwmb' ), 'icon' => 'dashicons-tagcloud', ), 'block_2' => array( 'label' => __( 'Blok 2', 'rwmb' ), 'icon' => 'dashicons-tagcloud', ), 'block_3' => array( 'label' => __( 'Blok 3', 'rwmb' ), 'icon' => 'dashicons-tagcloud', ), 'block_4' => array( 'label' => __( 'Blok 4', 'rwmb' ), 'icon' => 'dashicons-tagcloud', ), ), 'fields' => array( array( 'name' => __( 'Titel blok 1', 'rwmb' ), 'id' => 'component_footer_variant_1_box_2_title_block_1', 'type' => 'text', 'tab' => 'block_1', ), array ( 'id' => 'component_footer_variant_1_box_2_menu_1', 'name' => 'Selecteer menu', 'type' => 'select', 'placeholder' => 'Selecteer een menu', 'options' => get_registered_nav_menus(), 'tooltip' => 'Selecteer hier het menu wat in het eerste blok van de footer moet worden weergegeven', 'tab' => 'block_1', ), array( 'name' => __( 'Titel blok 2', 'rwmb' ), 'id' => 'component_footer_variant_1_box_2_title_block_2', 'type' => 'text', 'tab' => 'block_2', ), array ( 'id' => 'component_footer_variant_1_box_2_menu_2', 'name' => 'Selecteer menu', 'type' => 'select', 'placeholder' => 'Selecteer een menu', 'options' => get_registered_nav_menus(), 'tooltip' => 'Selecteer hier het menu wat in het tweede blok van de footer moet worden weergegeven', 'tab' => 'block_2', ), array( 'name' => __( 'Titel blok 3', 'rwmb' ), 'id' => 'component_footer_variant_1_box_2_title_block_3', 'type' => 'text', 'tab' => 'block_3', ), array ( 'id' => 'component_footer_variant_1_box_2_menu_3', 'name' => 'Selecteer menu', 'type' => 'select', 'placeholder' => 'Selecteer een menu', 'options' => get_registered_nav_menus(), 'tooltip' => 'Selecteer hier het menu wat in het derde blok van de footer moet worden weergegeven', 'tab' => 'block_3', ), array( 'name' => __( 'Titel blok 4', 'rwmb' ), 'id' => 'component_footer_variant_1_box_2_title_block_4', 'type' => 'text', 'tab' => 'block_4', ), array ( 'id' => 'component_footer_variant_1_box_2_menu_4', 'name' => 'Selecteer menu', 'type' => 'select', 'placeholder' => 'Selecteer een menu', 'options' => get_registered_nav_menus(), 'tooltip' => 'Selecteer hier het menu wat in het vierde blok van de footer moet worden weergegeven', 'tab' => 'block_4', ), ), ); $meta_boxes[] = array( 'id' => 'component_footer_variant_1_box_3', 'title' => __( 'Footer - derde rij', 'textdomain' ), 'settings_pages' => 'component_footer_variant_1', 'fields' => array ( array ( 'id' => 'component_footer_variant_1_box_3_logo_images', 'type' => 'group', 'name' => 'Logo\'s', 'clone' => true, 'sort_clone' => true, 'fields' => array ( array ( 'id' => 'component_footer_variant_1_box_3_logo_images_image', 'type' => 'image_advanced', 'name' => 'Logo afbeelding', ), array ( 'id' => 'component_footer_variant_1_box_3_logo_images_image_url', 'type' => 'url', 'name' => 'URL', ), ), ), ), ); $meta_boxes[] = array( 'id' => 'component_footer_variant_1_box_4', 'title' => __( 'Footer - vierde rij', 'textdomain' ), 'settings_pages' => 'component_footer_variant_1', 'fields' => array( array ( 'id' => 'component_footer_variant_1_box_4_footer_menu_bottom', 'name' => 'Selecteer menu', 'type' => 'select', 'placeholder' => 'Selecteer een menu', 'options' => get_registered_nav_menus(), 'tooltip' => 'Selecteer hier het menu wat helemaal onderaan de footer moet worden weergegeven', ), array ( 'id' => 'component_footer_variant_1_box_4_copyright_text', 'name' => 'Copyright tekst', 'type' => 'text', 'tooltip' => 'Copyright text die onderin de footer wordt weergegeven', ), ), ); return $meta_boxes; } ?>
March 31, 2017 at 5:27 PM #5451Anh Tran
KeymasterOK, I found the bug and just updated the Meta Box Yoast SEO plugin. Please update it.
March 31, 2017 at 6:07 PM #5453Webbio
ParticipantThanks a lot man! It works.
Love your product & support! Keep up the good work. This thread can be closed.
-
AuthorPosts
- The topic ‘Clone function not working’ is closed to new replies.