moxymore
Forum Replies Created
-
Forum: Plugins
In reply to: [Custom Post Type UI] You need some html entity decode for labelsWell, maybe a localised issue on my end. You can close the ticket then.
Forum: Plugins
In reply to: [Custom Post Type UI] You need some html entity decode for labelsHi,
This happens in the Gutenberg editor, in the right sidebar.
Screenshot : https://imgur.com/a/3AVGkhB
If I add any type of filters, like register_post_type_args or post_type_labels_mycptslug, the issue disapears. It’s probably something related with JSON and the gutenberg editor.
The related field seems to be $labels->singular_nameAllright, thanks for the answer. For sure it will work by copy/pasting the generated lines, but in a future I expected your plugin to put these lines under the first (let’s say) 10 lines. It’s totally doable, because native PHP functions allows you to analyse breaking lines.
Regards.- This reply was modified 11 months, 3 weeks ago by moxymore.
Allright, appreciated. Thanks.
Forum: Plugins
In reply to: [Advanced Forms for ACF] Bug spotted (true/false field), but easily fixableHi again,
You have answered at a post 2 days ago but skipped mine. I just would like to know if you were able to reproduce the issue, if it’s a know bug or if something is planned to correct this.
Regards.Message sent one minute ago to [email protected]
Forum: Plugins
In reply to: [CMB2] A wordpress repository question[EDIT] I have found the culpirit, but not the line in cmb2’s code : it’s the parameter
‘default’ => ‘on’
If you don’t set it or put in it an empty value, it works. If you put in it a default value of “on”, it will always stays ON even after a save change.
- This reply was modified 5 years, 8 months ago by moxymore.
Forum: Plugins
In reply to: [CMB2] A wordpress repository questionWell, this is definitely a bug… I have installed an approved GitHub’s contribution that is listed on your GitHub CMB2 description page, and the same issue occur : “on” value is never saved.
Forum: Plugins
In reply to: [CMB2] A wordpress repository questionUnfortunately not. I’m unable to make it work. Have you test on your own? Have you the same issue?
Hi Joy and thanks for your answer. I need the post title because it’s a part of the new upload directory. Moreover, when you create a new post, and before it’s saved for the first time, there’s no way to get this title with a standard $_POST. That’s why I expected to cover this case, by taking in real time what is written in the title field.
Regarding what you said, do you mean that there is an action hook for the upload button in which I can pass a parameter in it? Which one is this? I’m interested.
Regards.
Forum: Plugins
In reply to: [CMB2] Blank lines in Feed Rss@kezily Just tell to your dev (or do it yourself) to add this code in the proper file of your plugin location :
function custom_is_plugin_active( $plugin ) { return in_array( $plugin, (array) get_option( 'active_plugins', array() ) ) || custom_is_plugin_active_for_network( $plugin ); } function custom_is_plugin_active_for_network( $plugin ) { if ( ! is_multisite() ) { return false; } $plugins = get_site_option( 'active_sitewide_plugins' ); if ( isset( $plugins[ $plugin ] ) ) { return true; } return false; } if( !custom_is_plugin_active( WP_PLUGIN_DIR . '/cmb2/init.php' )) { if ( file_exists( YOUR_PLUGIN_PATH . '/cmb2/init.php' ) ) { require_once YOUR_PLUGIN_PATH . '/cmb2/init.php'; } elseif ( file_exists( YOUR_PLUGIN_PATH . '/CMB2/init.php' ) ) { require_once YOUR_PLUGIN_PATH . '/CMB2/init.php'; } }
This code is to adapt to the plugin itself.
A more simple solution, to wrap under conditional statement, could be done with
wp_deregister_style( 'cmb2-styles' );
:add_action( 'admin_enqueue_scripts', function () { // If statement made by you, needed to don't break CSS of your plugin wp_deregister_style( 'cmb2-styles' ); // endif });
This will deregister cmb2 stylesheet load and will solve your issue.
- This reply was modified 5 years, 8 months ago by moxymore.
Forum: Plugins
In reply to: [CMB2] A wordpress repository questionDo you had the time to check it maybe? This issue seems not related on my side, but on how cmb2 handle saved data with custom html markup. You’re probably busy, i’ll wait.
Have a nice day.
Forum: Plugins
In reply to: [CMB2] A wordpress repository questionI have nearly tested everything. My last try showed me something interesting : the saved value can only be ON or empty. I have seen this by modifying the checkbox’s generated HTML output (render_row_cb) for a text field. I was then able to see directly what happened after I hit the save button. Every single value different than “on” will return an empty string (checkbox disabled). If the value is “on”, it will be checked.
That’s said, if a checkbox can only accept an “on” or empty value, this means that the value itself is saved with something different than “on” when the checkbox is checked. Something is missing in my render_row_cb function … or something is wrong in cmb2 itself in the way he has to save datas.
Forum: Plugins
In reply to: [CMB2] A wordpress repository questionAllright, here we go. But first of all, please note that that when removing the ‘render_row_cb’ parameter, everything is properly save.
Description : I use cmb2 to generate an admin menu with submenus. The generation of this submenu is splitted into multiple files for code clarity. In my main menu plugin just generate the toplevel menu, and then I require_once the other files for submenus that are appended to the toplevel menu.
I’m giving you here the necessary code, because pasting all my fields here is useless imo :
$cpt_options = new_cmb2_box( array( 'id' => 'gia_cpt_options_page', 'title' => esc_html__( 'Custom post types', 'gia' ), 'object_types' => array( 'options-page' ), 'option_key' => 'gia_cpt_options', 'parent_slug' => 'gia_overview_options', 'save_button' => esc_html__( 'Save changes', 'gia' ), 'description' => 'My description goes here', 'display_cb' => 'gia_custom_cpt_page_output', // This is the callback for the custom HTML output of the form ) ); $cpt_options->add_field( array( 'name' => esc_html__( 'Module\'s activation', 'gia' ), 'desc' => esc_html__( 'Warning: disabling this option will deregister all your custom post types made with "Give It All". But don\'t worry, it will not delete anything. By reactivating this option later, all your datas will be back again.', 'gia' ), 'id' => 'gia_activate_cpt', 'type' => 'checkbox', 'classes' => 'gia-radio switch switch--horizontal', 'attributes' => array( 'id' => 'activate_cpt_field', ), 'before_row' => 'gia_open_custom_field_row_wrapper', 'after_row' => 'gia_close_custom_field_row_wrapper', 'render_row_cb' => 'gia_test_render_row_cb' ) ); function gia_test_render_row_cb( $field_args, $field ) { $id = $field->args( 'id' ); $label = $field->args( 'name' ); $name = $field->args( '_name' ); $value = $field->escaped_value(); $description = $field->args( 'desc' ); $cpt_datas = cmb2_get_option( 'gia_cpt_options', // option_key of the CPT submenu 'gia_add_cpt' // field id); $valuetest = $field; var_dump($valuetest); ?> <div class="switch switch--horizontal"> <ul class="tg-list"> <li class="tg-list-item"> <input id="<?php echo $id; ?>" class="tgl tgl-flip" name="<?php echo $name; ?>" type="checkbox" value="<?php echo $value; ?>"/> <label for="<?php echo $id; ?>" class="tgl-btn" data-tg-off="Nope" data-tg-on="Yeah!"></label> </li> </ul> <p class="description"><?php echo $description; ?> </div><?php }
Here is the function to generate the HTML output of the form :
function gia_custom_cpt_page_output( $hookup ) { ?> <div class="gia-wrap wrap cmb2-options-page option-<?php echo $hookup->option_key; ?>"> <?php if ( $hookup->cmb->prop( 'title' ) ) : ?> <h2 class="gia-title"><?php echo wp_kses_post( $hookup->cmb->prop( 'title' ) ); ?></h2> <?php endif; ?> <?php if ( $hookup->cmb->prop( 'description' ) ) : ?> <h3 class="gia-desc"><?php echo wp_kses_post( $hookup->cmb->prop( 'description' ) ); ?></h3> <?php endif; ?> <form class="gia-form gia-cpt-form cmb-form" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>" method="POST" id="<?php echo $hookup->cmb->cmb_id; ?>" enctype="multipart/form-data" encoding="multipart/form-data"> <input type="hidden" name="action" value="<?php echo esc_attr( $hookup->option_key ); ?>"> <?php $hookup->options_page_metabox(); ?> <?php submit_button( esc_attr( $hookup->cmb->prop( 'save_button' ) ), 'primary', 'submit-cmb' ); ?> </form> </div> <?php }
- This reply was modified 5 years, 8 months ago by moxymore.
Forum: Plugins
In reply to: [CMB2] A wordpress repository questionThe problem seems to be with this :
$field->escaped_value
, it returns nothing. This part is missing from my exemple code, but I have just added a line like this$value = $field->escaped_value();
I confirm that nothing is saved, I have inspected the $field object.
- This reply was modified 5 years, 8 months ago by moxymore.