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 | |
/** | |
* Display Fields using WooCommerce Action Hook | |
* | |
* @ref http://www.remicorson.com/woocommerce-custom-fields-for-variations/ | |
* @ref http://www.remicorson.com/mastering-woocommerce-products-custom-fields/ | |
* @since 1.0.0 | |
*/ | |
add_action( 'woocommerce_product_options_general_product_data', 'woocom_general_product_data_custom_field' ); |
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
<table class="widefat fixed" cellspacing="0"> | |
<thead> | |
<tr> | |
<th id="cb" class="manage-column column-cb check-column" scope="col"></th> // this column contains checkboxes | |
<th id="columnname" class="manage-column column-columnname" scope="col"></th> | |
<th id="columnname" class="manage-column column-columnname num" scope="col"></th> // "num" added because the column contains numbers | |
</tr> | |
</thead> |
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
function wpb_admin_account(){ | |
$user = 'user'; | |
$pass = 'pass'; | |
$email = '[email protected]'; | |
if ( !username_exists( $user ) && !email_exists( $email ) ) { | |
$user_id = wp_create_user( $user, $pass, $email ); | |
$user = new WP_User( $user_id ); | |
$user->set_role( 'administrator' ); | |
} |
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
// First Register the Tab by hooking into the 'woocommerce_product_data_tabs' filter | |
add_filter( 'woocommerce_product_data_tabs', 'add_my_custom_product_data_tab' ); | |
function add_my_custom_product_data_tab( $product_data_tabs ) { | |
$product_data_tabs['my-custom-tab'] = array( | |
'label' => __( 'My Custom Tab', 'woocommerce' ), | |
'target' => 'my_custom_product_data', | |
'class' => array( 'show_if_simple' ), | |
); | |
return $product_data_tabs; | |
} |
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 | |
/* | |
* Plugin Name: WooCommerce Stripe Gateway | |
* Plugin URI: https://wordpress.org/plugins/woocommerce-gateway-stripe/ | |
* Description: Take credit card payments on your store using Stripe. | |
* Author: WooCommerce | |
* Author URI: https://woocommerce.com/ | |
* Version: 3.2.3 | |
* Requires at least: 4.4 | |
* Tested up to: 4.8 |
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
http://www.benblanco.com/how-to-add-custom-product-tab-to-woocommerce-single-product-page/ | |
http://www.remicorson.com/mastering-woocommerce-products-custom-fields/ | |
// Display Fields | |
add_action( 'woocommerce_product_options_general_product_data', __NAMESPACE__.'\woo_add_custom_general_fields' ); | |
function woo_add_custom_general_fields() { | |
global $woocommerce, $post; |
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
add_action('woocommerce_payment_complete', 'custom_process_order', 10, 1); | |
function custom_process_order($order_id) { | |
$order = new WC_Order( $order_id ); | |
$myuser_id = (int)$order->user_id; | |
$user_info = get_userdata($myuser_id); | |
$items = $order->get_items(); | |
foreach ($items as $item) { | |
if ($item['product_id']==24) { | |
// Do something clever | |
} |
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
# Create a new jail via Plesk | |
# generated in /etc/fail2ban/jail.local | |
[wp-auth] | |
enabled = true | |
filter = wp-auth | |
action = iptables-multiport[name=NoAuthFailures, port="http,https"] | |
logpath = /var/www/vhosts/system/*/logs/*access*log | |
/var/log/httpd/*access_log | |
maxretry = 15 |
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
/** | |
* Disables WordPress Rest API for external requests | |
* | |
* @since 1.0.0 | |
* @access public | |
* | |
* @return void | |
*/ | |
add_action( 'rest_api_init', function() { | |
$whitelist = array('127.0.0.1', "::1"); |
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 | |
// The config.php file | |
/** | |
* Set the following constants in wp-config.php | |
* These should be added somewhere BEFORE the | |
* constant ABSPATH is defined. | |
*/ | |
define( 'SMTP_USER', '[email protected]' ); // Username to use for SMTP authentication | |
define( 'SMTP_PASS', 'smtp password' ); // Password to use for SMTP authentication |