Blog
-
Hide WooCommerce payment or shipping methods conditionally and programatically
Payment gateways: woocommerce_available_payment_gateways filter hook
Shipping gateways: woocommerce_package_rates filter hook
-
Install PHPUnit with WP
Local development
PHPUnit versions vs. WP versions
You may need additional libraries and help. Use Google for that.
-
Adding an admin submenu page to a custom post type CPT
add_submenu_page( 'edit.php?post_type=wnm_funds', 'Fund Settings', /*page title*/ 'Settings', /*menu title*/ 'manage_options', /*roles and capabiliyt needed*/ 'wnm_fund_set', 'CALLBACK_FUNCTION_NAME' /*replace with your own function*/ );
-
WooCommerce admin settings options
Extending the WooCommerce Documentation page: https://woocommerce.com/document/settings-api/
'option_name' => array( 'type' => 'title|sectionend|text|password|datetime|datetime-local|date|month|time|week|number|emailk|url|tel|color|textarea|radio|checkbox|select|multiselect|image_width|single_select_page|single_select_page_with_search|single_select_country|multi_select_countries|relative_date_selector', //Required 'id' => 'Unique field ID', 'title' => 'Title for your option shown on the settings page', 'class' => 'Space separated classes for the input', 'css' => 'Space and ; separated CSS rules added line to the input', 'default' => 'Default value for the option', 'desc' => 'Description for your option shown on the settings page',1 'desc_tip' => 'Description for your option shown on the settings page', 'placeholder' => 'Placeholder for the text field types', 'suffix' => 'Content to place after text field field types', 'value' => 'Do not set it as Woo will set it for you', 'custom_attributes' => 'Array of type key => value that will be appended in the field construction sequence', //Eg. array( 'max' => '100', 'maxlength' => 3 ) 'label' => 'Label', // checkbox only 'options' => array( 'key' => 'value' ) // array of options for select/multiselects only );
to create your own type of field, there is an available action that takes in 1 parameter – $value
woocommerce_admin_field_{$type}
eg. usage:
add_action( 'woocommerce_admin_field_my_custom_type', 'my_custom_field_type', 10, 1 ); function my_custom_field_type( $value ) { echo '<field value="' . $value . '">Label</field>'; }
-
“SSH Too Many Authentication Failures” Error
To fix this error, you need to add the
IdentitiesOnly
with a value ofyes
, which instructs ssh to only use the authentication identity files specified on the command line or the configured in the ssh_config file(s), even if ssh-agent offers additional identities.For example:
$ ssh -o IdentitiesOnly=yes vps2
More info in this article
On a side note, if FileZilla shoots an error at connecting, run the following command from the terminal:
$ SSH_AUTH_SOCK=null filezilla &
-
Install MySQL on Mac with Homebrew
Uninstall first if needed
brew remove mysql brew cleanup launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist sudo rm -rf /usr/local/var/mysql
Install
brew install mysql mysqld --initialize --explicit_defaults_for_timestamp mysql.server start # no sudo!
Another good guide here
Useful commands
brew services start mysql brew services stop mysql brew services restart mysql
-
Install Nginx, PHP, MySQL on Mac
A very good guide here