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 | |
// Specify which users should show up in Edit Flow user lists. | |
add_filter( 'ef_users_select_form_get_users_args', function( $args ) { | |
unset( $args['who'] ); | |
$args['role__in'] = array( 'administrator', 'editor', 'author' ); | |
return $args; | |
} ); |
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 | |
// Don't send notification emails for pingbacks and trackbacks. | |
add_filter( 'notify_post_author', function( $maybe_notify, $comment_ID ) { | |
$comment_type = get_comment_type( $comment_ID ); | |
if ( in_array( $comment_type, array( 'pingback', 'trackback' ), true ) ) { | |
$maybe_notify = false; | |
} |
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 | |
/** | |
* Hide "Cash on Delivery" on the order-pay page, and hide PayPal on the main checkout page. | |
*/ | |
function wc_ninja_conditional_gateways_for_order_pay( $available_gateways ) { | |
if ( is_wc_endpoint_url( 'order-pay' ) ) { | |
unset( $available_gateways['cod'] ); | |
} else { | |
unset( $available_gateways['paypal'] ); |
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 | |
/** | |
* Grant 100 extra points for every successful checkout. | |
*/ | |
add_action( 'woocommerce_checkout_order_processed', 'wc_test_add_points', 10, 3 ); | |
function wc_test_add_points( $order_id, $posted_data, $order ) { | |
WC_Points_Rewards_Manager::increase_points( $order->get_user_id(), '100', 'customer-checkout-out' ); | |
} |
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
add_filter( 'woocommerce_loop_add_to_cart_link', 'wc_ninja_change_external_product_button', 15, 3 ); | |
function wc_ninja_change_external_product_button( $button, $product, $args ) { | |
$url = $product->add_to_cart_url(); | |
if ( 'external' === $product->get_type() ) { | |
$url = $product->get_permalink(); | |
} | |
return sprintf( '<a href="%s" data-quantity="%s" class="%s" %s>%s</a>', | |
esc_url( $url ), |
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 | |
/* Plugin Name: Damn Vulnerable WordPress Plugin | |
* Description: Intentionally vulnerable plugin for plugin author education | |
* Version: 0.1 | |
* Plugin URI: http://make.wordpress.org/plugins/2013/04/09/intentionally-vulnerable-plugin/ | |
* Author: Jon Cave | |
* Author URI: http://joncave.co.uk | |
* Text Domain: damn-vulnerable-wordpress-plugin | |
* License: GPLv2+ | |
* |
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
add_action( 'init', 'wc_ninja_update_default_category_once' ); | |
function wc_ninja_update_default_category_once() { | |
// 20 = new default category ID | |
update_option( 'default_product_cat', '20' ); | |
} |
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
add_filter( 'woocommerce_hide_invisible_variations', '__return_true' ); |
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 | |
add_filter( 'manage_shop_order_posts_columns', 'wc_define_columns', 15 ); | |
function wc_define_columns( $columns ) { | |
$columns['customer_notes'] = __( 'Customer Notes', 'woocommerce' ); | |
return $columns; | |
} | |
add_action( 'manage_shop_order_posts_custom_column', 'wc_render_customer_notes_column', 10, 2 ); | |
function wc_render_customer_notes_column( $column, $post_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
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10); | |
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10); | |
add_action('woocommerce_before_main_content', 'custom_themewrapper_start', 10); | |
add_action('woocommerce_after_main_content', 'custom_themewrapper_end', 10); | |
function custom_themewrapper_start() { | |
echo '<div class="main"><div class="row"><div class="large-12 medium-12 small-12 columns content">'; | |
} |