This file contains hidden or 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 replace_plugin() { | |
// modify these variables with your new/old plugin values | |
$plugin_slug = 'wp-reset/wp-reset.php'; | |
$plugin_zip = 'https://downloads.wordpress.org/plugin/wp-reset.latest-stable.zip'; | |
$old_plugin_slug = 'reset-wp/reset-wp.php'; | |
echo 'If things are not done in a minute <a href="plugins.php">click here to return to Plugins page</a><br><br>'; | |
echo 'Starting ...<br><br>'; | |
This file contains hidden or 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 | |
$states = array( | |
'RIY' => esc_html__('Riyadh','porto'), | |
'MEC' => esc_html__('Mecca','porto'), | |
'MED' => esc_html__('Medina','porto'), | |
'BUR' => esc_html__('Buraydah','porto'), | |
'TAB' => esc_html__('Tabuk','porto'), | |
'DAM' => esc_html__('Dammam','porto'), | |
'AL ' => esc_html__('Al Ahsa','porto'), |
This file contains hidden or 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 | |
$states = array( | |
'RIY' => esc_html__('Riyadh','porto'), | |
'MEC' => esc_html__('Mecca','porto'), | |
'MED' => esc_html__('Medina','porto'), | |
'BUR' => esc_html__('Buraydah','porto'), | |
'TAB' => esc_html__('Tabuk','porto'), | |
'DAM' => esc_html__('Dammam','porto'), | |
'AL ' => esc_html__('Al Ahsa','porto'), |
This file contains hidden or 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 | |
add_filter( 'woocommerce_states', 'dw_woocommerce_states' ); | |
function dw_woocommerce_states( $states ) { | |
$states['KW'] = array( | |
'KWQ' => __('Dasmān','porto'), | |
'KWA' => __('Sharq','porto'), | |
'KWZ' => __('Mirgāb','porto'), | |
'KWW' => __('Jibla','porto'), |
This file contains hidden or 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 is_empty_cart() { | |
if ( ! class_exists( 'woocommerce' ) ) { | |
return false; //Woocpmmerce isn't isntalled | |
} | |
if ( sizeof( WC()->cart->get_cart() ) > 0 ) { | |
return false; //Cart is not empty | |
} |
This file contains hidden or 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 prefix_generate_uuid() { | |
return sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x', | |
// 32 bits for "time_low" | |
mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), | |
// 16 bits for "time_mid" | |
mt_rand( 0, 0xffff ), |
This file contains hidden or 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 prefix_orders_count() { | |
if ( ! class_exists( 'woocommerce' ) ) { | |
return false; | |
} | |
$args = [ | |
'posts_per_page' => - 1, | |
'post_type' => 'shop_order', | |
'post_status' => 'any', |
This file contains hidden or 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 prefix_top_customers_with_total_spend( $length = 5 ) { | |
if ( ! class_exists( 'woocommerce' ) ) { | |
return; | |
} | |
$data = []; | |
$args = [ | |
'role' => 'customer', | |
'number' => - 1, | |
'fields' => 'ID' |
This file contains hidden or 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 | |
//use the following code in your plugin to run some logic on plugin activation, deactivation or uninstall events | |
register_activation_hook( __FILE__, 'prefix_plugin_activate' ); | |
function prefix_plugin_activate() { | |
if ( ! current_user_can( 'activate_plugins' ) ) { | |
return; | |
} | |
$plugin = isset( $_REQUEST['plugin'] ) ? $_REQUEST['plugin'] : ''; |
This file contains hidden or 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
**Archive Page** | |
- Before Main Content `woocommerce_before_main_content` | |
- Before Shop Loop `woocommerce_before_shop_loop` | |
- Before Shop Loop Item `woocommerce_before_shop_loop_item` | |
- Before Shop Loop Item Title `woocommerce_before_shop_loop_item_title` | |
- After Shop Loop Item Title `woocommerce_after_shop_loop_item_title` | |
- After Shop Loop Item `woocommerce_after_shop_loop_item` | |
- After Shop Loop `woocommerce_after_shop_loop` | |
- After Main Content `woocommerce_after_main_content` |