This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Function to generate a random encryption key | |
function generateEncryptionKey($length = 32) | |
{ | |
return bin2hex(random_bytes($length)); | |
} | |
// Function to encrypt credit card information | |
function encryptCreditCard($creditCardNumber, $encryptionKey) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Get shipping info by using chosen method from cart | |
* | |
* @param string $type | |
* @return string | |
*/ | |
function ml_get_shipping_data($type = '') { | |
$current_shipping_method = WC()->session->get( 'chosen_shipping_methods' ); | |
if( ! is_array($current_shipping_method) ) { | |
return ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Hide shipping rates when free shipping is available. | |
* Updated to support WooCommerce 2.6 Shipping Zones. | |
* | |
* @param array $rates Array of rates found for the package. | |
* @return array | |
*/ | |
function allaround_hide_shipping_when_free_is_available( $rates ) { | |
// Here your free shipping rate Id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* get percentage by quantity | |
*/ | |
function sakib_get_discount( $quantity ) { | |
switch ($quantity) { | |
case 6: | |
$discount = 20; | |
break; | |
case 10: | |
$discount = 30; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
C:\xampp\mysql\bin\mysql.exe -u root -p -v portal < "C:\Users\marsh\Downloads\yourdb.sql" | |
for more info https://thecodedeveloper.com/import-large-sql-files-xampp/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Download multiples files at once in WordPress | |
*/ | |
function vdm_files_downloads() { | |
if ( | |
! isset( $_POST['vdm_download_nonce'] ) | |
|| ! wp_verify_nonce( $_POST['vdm_download_nonce'], 'vdm_download_action' ) | |
|| !isset($_POST['vdm_download_files']) | |
|| empty($_POST['vdm_download_files']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
---------------------------------------------------------------------- | |
// C:\xampp\php\php.ini | |
---------------------------------------------------------------------- | |
[mail function] | |
smtp_port=587 | |
sendmail_from = your-gmail@gmail.com | |
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t" | |
---------------------------------------------------------------------- | |
// C:\xampp\sendmail\sendmail.ini |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<ruleset name="WordPress Theme Coding Standards"> | |
<!-- See https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml --> | |
<!-- See https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards --> | |
<!-- See https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki --> | |
<!-- See https://github.com/wimg/PHPCompatibility --> | |
<!-- Set a description for this ruleset. --> | |
<description>A custom set of code standard rules to check for WordPress themes.</description> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function wpse64458_in_widget_form($t,$return,$instance){ | |
$instance = wp_parse_args( (array) $instance, array( 'column' => 'default', 'title' => '') ); | |
if ( !isset($instance['column']) ) | |
$instance['column'] = null; | |
?> | |
<p> | |
<label for="<?php echo $t->get_field_id('column'); ?>"><?php esc_html_e('Column', 'textdomain'); ?>: </label> | |
<select id="<?php echo $t->get_field_id('column'); ?>" name="<?php echo $t->get_field_name('column'); ?>"> | |
<option <?php selected($instance['column'], 'default');?> value="default"><?php esc_html_e('Default', 'textdomain'); ?></option> | |
<option <?php selected($instance['column'], '1');?>value="1"><?php esc_html_e('1', 'textdomain'); ?></option> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
First go the mysql folder where your localhost install. in my case I'm using xampp. | |
In reqular xampp password will be blank as default unless you set something. If it is blank then you can just leave as blank like | |
--password= | |
======================== | |
1. cd C:\xampp\mysql\bin | |
2. mysqldump --user=root --password=password mydbname > mydbname-backup.sql | |
======================== | |
Backup file will be avaliable in C:\xampp\mysql\bin folder. | |
For more info visit. |
NewerOlder