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
<script type="text/javascript"> | |
jQuery( document ).ready( function ( $ ) { | |
var data = { | |
action: 'my_action', | |
security: '<?php echo wp_create_nonce( "bk-ajax-nonce" ); ?>' | |
}; | |
$.post( ajaxurl, data, function ( response ) { | |
alert( "Response: " + response ); | |
} ); | |
} ); |
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
check_ajax_referer( 'bk-ajax-nonce', 'security' ); |
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
check_ajax_referer( 'bk-ajax-nonce', 'security', false ); |
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
# Install Mailcatcher | |
if [ ! -f /var/log/mailcatchersetup ]; | |
then | |
sudo /opt/vagrant_ruby/bin/gem install mailcatcher | |
sudo touch /var/log/mailcatchersetup | |
fi | |
# Configure sendmail_path for MailCatcher | |
sudo sed -i '/;sendmail_path =/c sendmail_path = "/opt/vagrant_ruby/bin/catchmail"' /etc/php5/apache2/php.ini |
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 wpjm_rp4wp_add_meta_fields( $meta_fields, $post_id, $post ) { | |
if ( 'post' == $post->post_type ) { | |
$meta_fields = array( 'wpjm_company' ); | |
} | |
return $meta_fields; | |
} | |
add_filter( 'rp4wp_related_meta_fields', 'wpjm_rp4wp_add_meta_fields', 10, 3 ); |
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 custom_rp4wp_add_meta_fields( $meta_fields, $post_id, $post ) { | |
// replace my_post_type with your post type | |
if ( 'my_post_type' === $post->post_type ) { | |
// replace my_post_meta_field with your meta key. You can add as many as you like | |
$meta_fields[] = 'my_post_meta_field'; | |
} | |
return $meta_fields; | |
} |
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 bk_rp4wp_change_weight( $weight, $post, $meta_field ) { | |
if ( 'my_post_type' === $post->post_type && 'my_post_meta_field' === $meta_field ) { | |
$weight = 100; | |
} | |
return $weight; | |
} | |
add_filter( 'rp4wp_related_meta_fields_weight', 'bk_rp4wp_change_weight', 10, 3 ); |
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
// Mark virtual orders as complete instead of processing | |
function rp4wp_virtual_order_payment_complete_order_status( $order_status, $order_id ) { | |
$order = new WC_Order( $order_id ); | |
if ( 'processing' == $order_status && ( 'on-hold' == $order->status || 'pending' == $order->status || 'failed' == $order->status ) ) { | |
$virtual_order = false; | |
if ( count( $order->get_items() ) > 0 ) { |
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_filter( 'wc_anti_fraud_rules', 'wc_remove_antifraud_rules'); | |
/** | |
* Remove unwanted anti-fraud rules | |
* | |
* @return array | |
*/ | |
function wc_remove_antifraud_rules( $rules ) { | |
foreach ( $rules as $key => $rule ) { |