Skip to content

Instantly share code, notes, and snippets.

@bentasm1
bentasm1 / functions.php
Last active August 29, 2015 14:09 — forked from kloon/functions.php
Add text after product price
<?php
// Add R xx.xx per KG
add_action( 'woocommerce_price_html', 'wc_custom_price', 10, 2 );
function wc_custom_price( $price, $product ) {
return sprintf( __( '%s per KG', 'woocommerce' ), woocommerce_price( $product->get_price() ) );
}
?>
@bentasm1
bentasm1 / functions.php
Created October 10, 2015 15:24 — forked from digitalchild/functions.php
Change the Add Product URL on Pro Vendor dashboard
<?php
// Change the "Add Product" button url to the back end.
add_filter('wcv_add_product_url', 'new_add_product_url');
function new_add_product_url(){
return admin_url('post-new.php?post_type=product');
}
?>
@bentasm1
bentasm1 / product-edit.php
Created October 28, 2015 21:42 — forked from digitalchild/product-edit.php
WC Vendors Pro - Replace product descriptions with wordpress editor
<?php
// This code goes in the product-edit.php override template for wc-vendors pro
// Replace WCVendors_Pro_Product_Form::description( $object_id, $product_description );
// with
$product_description_args = array(
'editor_height' => 200,
'media_buttons' => true,
'teeny' => true,
@bentasm1
bentasm1 / functions.php
Created November 3, 2015 22:34 — forked from digitalchild/functions.php
Change dashboard date range
<?php
add_filter('wcv_dashboard_start_date', 'dashboard_start_date' );
function dashboard_start_date() {
return '-1 week';
}
@bentasm1
bentasm1 / functions.php
Created November 3, 2015 22:43 — forked from digitalchild/functions.php
Change the Pro Dashboard Date Range
<?php
// Change the start date
// from 1 year ago to 1 week ago
add_filter('wcv_dashboard_start_date', 'dashboard_start_date' );
function dashboard_start_date() {
return '-1 week';
}
// Change the end date
@bentasm1
bentasm1 / functions.php
Created November 7, 2015 18:54 — forked from digitalchild/functions.php
Only display the sold by if the product owner is a vendor
<?php
// Put this in your themes functions.php
// Remove all existing actions and filters
remove_action( 'woocommerce_after_shop_loop_item', array( 'WCV_Vendor_Shop', 'template_loop_sold_by'), 9, 2);
remove_filter( 'woocommerce_get_item_data', array( 'WCV_Vendor_Cart', 'sold_by' ), 10, 2 );
remove_action( 'woocommerce_product_meta_start', array( 'WCV_Vendor_Cart', 'sold_by_meta' ), 10, 2 );
remove_filter( 'woocommerce_order_product_title', array( 'WCV_Emails', 'show_vendor_in_email' ), 10, 2 );
remove_action( 'woocommerce_add_order_item_meta', array( 'WCV_Vendor_Shop', 'add_vendor_to_order_item_meta'), 10, 2 );
remove_action( 'woocommerce_after_shop_loop_item', array( $wcvendors_pro->wcvendors_pro_store_controller, 'loop_sold_by' ), 8 );
@bentasm1
bentasm1 / jetpack-bot-challenge-text-change.php
Created December 11, 2015 03:16 — forked from digisavvy/jetpack-bot-challenge-text-change.php
Change Jetpack Protect Bot Challenge Text
/**
* Change text string for Jetpack Protect Bot Challenge Text
*
* @link http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext
*/
function digisavvy_change_humanity_string( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Prove your humanity:' :
$translated_text = __( 'Prove you\'re not a bot', 'jetpack' );
break;
@bentasm1
bentasm1 / functions.php
Last active February 16, 2016 02:04 — forked from digitalchild/functions.php
Give vendors permissions to edit media
<?php
// The following functions will allow a vendor to edit and delete their media alt text and descriptions.
// HOWEVER this requires post editing permissions so would also allow them to edit ALL posts and comments on
// your site if they know how to do it.
// WC Vendors will not support this code and is provided for educational purposes only.
// THIS IS DANGEROUS TO DO -- USE AT YOUR OWN RISK -- YOU HAVE BEEN WARNED!
// Update vendor role to support media handling
function update_vendor_role( ){
@bentasm1
bentasm1 / move-proceed-to-checkout
Created February 18, 2016 05:17 — forked from BurlesonBrad/move-proceed-to-checkout
Get the friggin' Proceed To Checkout button to the TOP of the page (not the bottom!!)
add_action( 'woocommerce_before_cart', 'move_proceed_button' );
function move_proceed_button( $checkout ) {
echo '<a href="' . esc_url( WC()->cart->get_checkout_url() ) . '" class="checkout-button button alt wc-forward" >' . __( 'Proceed to Checkout', 'woocommerce' ) . '</a>';
}
@bentasm1
bentasm1 / functions.php
Created March 16, 2016 05:10 — forked from digitalchild/functions.php
WCV Pro vendor list pagination customisation
<?php
// WC Vendors Pro vendors list uses the same layout as the default woocommerce pagination
// IF your theme is overriding the layout of the pagination links then you can use the following snippets (modified for your theme)
// to make the vendor list pagination links wrap with your theme wrappers and styles.
// Pagination wrapper opening tag
add_filter( 'wcv_pagination_before', 'wcv_pagination_before_wrapper' );
function wcv_pagination_before_wrapper( $html ) {
return '<div class="somethign else">';