Categories
CMS Mastering Development Wordpress

How to create a custom block in Gutemberg with multiple checkboxes?

I am trying to create a plugin that will add a custom block in Gutenberg that will display a div with a combination 3 links on the frontend, based on the options that that I choose in the editor. In other words, if I have L1 (link 1), L2 (link 2) and L3 (link 3), […]

Categories
Mastering Development

console.log an array of checked checkbox values in React

I want to console.log an array of the checkboxes that are checked. Like if checkbox 1, 2, and 5 are checked, I want it to show in the console as an array of each checkbox’s value. I can get the last value selected to show up in the console, but I can’t get an array […]

Categories
CMS Mastering Development Wordpress

Update File using Settings API init_form_fields

I have an existing plugin(payment gateway for woocommerce) that goes about generating settings as follows: In the constructor, It does the following: $this->init_form_fields(); $this->init_settings(); // Calls all the fields $this->title = $this->get_option( ‘title’ ); In the init_form_fields function: $this->form_fields = array( ‘enabled’ => array( ‘title’ => __( ‘Enable/Disable:’, ‘plugin-name’ ), ‘type’ => ‘checkbox’, ‘label’ => […]

Categories
CMS Mastering Development Wordpress

Settings checkbox not triggering function

I have recently created this code as a plugin to store a setting in the WooCommerce general settings. The checkbox is meant to // Check if WooCommerce is active if ( in_array( ‘woocommerce/woocommerce.php’, apply_filters( ‘active_plugins’, get_option( ‘active_plugins’ ) ) ) ) { // Settings function hm_woo_disable_shop_settings( $settings ) { $settings[] = array( ‘title’ => __( […]

Categories
CMS Mastering Development Wordpress

Gutenberg/WordPress – Limit number of categories

I would like to limit the number of categories chosen (3 max) in the categories list of WordPress. But Gutenberg interface use React and my jQuery code don’t work. Can I have some help please ? jQuery(window).load(function() { var limit = 3; $(‘.edit-post-sidebar input.components-checkbox-control__input’).on(‘change’, function(evt) { if($(this).siblings(‘:checked’).length >= limit) { this.checked = false; } }); […]

Categories
CMS Mastering Development Wordpress

Gutenberg/WordPress – Limit number of categories

I would like to limit the number of categories chosen (3 max) in the categories list of WordPress. But Gutenberg interface use React and my jQuery code don’t work. Can I have some help please ? jQuery(window).load(function() { var limit = 3; $(‘.edit-post-sidebar input.components-checkbox-control__input’).on(‘change’, function(evt) { if($(this).siblings(‘:checked’).length >= limit) { this.checked = false; } }); […]

Categories
CMS Mastering Development Wordpress

Gutenberg/WordPress – Limit number of categories with React

I would like to limit the number of categories chosen (3 max) in the categories list of WordPress. But Gutenberg interface use React and my jQuery code don’t work. Can I have some help please ? jQuery(window).load(function() { var limit = 3; $(‘.edit-post-sidebar input.components-checkbox-control__input’).on(‘change’, function(evt) { if($(this).siblings(‘:checked’).length >= limit) { this.checked = false; } }); […]

Categories
CMS Mastering Development Wordpress

Gutenberg/WordPress – Limit number of categories with React

I would like to limit the number of categories chosen (3 max) in the categories list of WordPress. But Gutenberg interface use React and my jQuery code don’t work. Can I have some help please ? jQuery(window).load(function() { var limit = 3; $(‘.edit-post-sidebar input.components-checkbox-control__input’).on(‘change’, function(evt) { if($(this).siblings(‘:checked’).length >= limit) { this.checked = false; } }); […]

Categories
CMS Mastering Development Wordpress

Gutenberg/WordPress – Limit number of categories with React

I would like to limit the number of categories chosen (3 max) in the categories list of WordPress. But Gutenberg interface use React and my jQuery code don’t work. Can I have some help please ? jQuery(window).load(function() { var limit = 3; $(‘.edit-post-sidebar input.components-checkbox-control__input’).on(‘change’, function(evt) { if($(this).siblings(‘:checked’).length >= limit) { this.checked = false; } }); […]

Categories
Mastering Development

Using Jquery how do I get dynamically generated checkboxes checked status inside a function called on a button click

Using jquery, coming out of an ajax call I have an ‘each’ statement that generates checkboxes. Here is the line that actually does the generation and append inside my script. $(‘<input />’, { type: ‘checkbox’, id: value.rental_accessories_id, value: value.partnumber, class: ‘accessories’ }).appendTo($(‘#form_container’); On a click of a button I am executing a function in the […]