Forum Replies Created
-
AuthorPosts
-
December 6, 2017 at 8:40 AM in reply to: โ Refresehing the whole WP Admin Panel after settings saved #7767
Anh Tran
KeymasterHi G.,
I guess I understand your point. Probably the code that saves data happens after your code that hides menus, metaboxes, etc. Would you please post your code here so I can debug that?
Anh Tran
KeymasterHi,
For your needs, the
image_selectfield seems to be the suitable field type. However, it doesn't have the pagination or search feature. To do that, I think you need to write a custom code using a filter library like ListJS (there are probably more libraries).You can hook to
rwmb_enqueue_scriptsaction to enqueue your JS like this:add_action( 'rwmb_enqueue_scripts', function() { wp_enqueue_style( 'listjs', 'URL here' ); wp_enqueue_script( 'listjs', 'URL here' ); wp_enqueue_script( 'your-js', 'URL here' ); } );And in your JS file, you can write the JS that does the filtering or searching.
Anh Tran
KeymasterHi,
Looks like you're using cloneable groups. For each value of a group, please check the existence of sub-fields, like this:
$title = isset( $item_item_item['title'] ) ? $item_item_item['title'] : ''; echo $title;Anh Tran
KeymasterHi,
I think hooking to
wp_insert_post_datais too generic as it fires every time a post is added/updated.The extension already have 2 filters that you can use to change the post data when saving:
rwmb_frontend_update_post_datafor updating posts andrwmb_frontend_insert_post_datafor creating new posts. Previously it has only 1 params: the submitted post data. But I've just updated the extension, adding 2nd parameter: the shortcode params, so you can use to check whether you are on the right meta box.This is sample code:
add_filter( 'rwmb_frontend_insert_post_data', 'your_function', 10, 2 ); add_filter( 'rwmb_frontend_update_post_data', 'your_function', 10, 2 ); function your_function( $data, $config ) { if ( $config['id'] !== 'your_meta_box_id' ) { return $data; } // Your code to get post_title $data['post_title'] = ...; return $data; }Please try it and let me know if you need anything. I can update the extension to make it works for you.
Anh Tran
KeymasterHi, I see the bug. I'm debugging it and will fix it as soon as I can.
Anh Tran
KeymasterHi Hazmi,
Regarding the 1st problem, can you please describe steps to replicate it? I couldn't replicate on my side. But my guess is the saved value in the DB. If you already saved values of your fields into an option, then when you add a new field which has name already registered before, then the value might be taken from the previous one. Not sure if that's the case, but you can try remove the option in the DB and try again.
Regarding the problem with QTag, do you have any wysiwyg field in your settings page? QTags is available only for the editor. With the code above, I can't see anything in the console:
Anh Tran
KeymasterHi,
I've just fixed it on Github. The error message now will display below the inputs. Can you please try it?
Anh Tran
KeymasterHi,
I've just tried your code and this is my screenshot:
Can you guys post the code that includes the heading field?
Anh Tran
KeymasterHi, I've fixed this bug on Github. Can you please try it?
PS: My previous reply was for the PHP warning that you posted. Sorry for misunderstanding.
Anh Tran
KeymasterHi, I'm still checking it. Please wait.
Anh Tran
KeymasterHi,
The field type "sidebar" has just been added. Demo here.
Anh Tran
KeymasterThanks, I will check it now.
Anh Tran
KeymasterCan you please post the code of meta box so I can check?
Thanks,
AnhAnh Tran
KeymasterHi,
You can bundle the extensions in a plugin. Just copy the extensions to plugin's folder, then include the main PHP file of each extension. For more info, please follow this docs.
Regarding Composer, unfortunately we don't support extensions for now. They're hosted on private repos on Bitbucket.
Thanks,
Anh -
AuthorPosts