Skip to content

Instantly share code, notes, and snippets.

@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 May 30, 2020 15:50 — forked from digitalchild/functions.php
Add custom link to pro dashboard navigation tabs
/* WC Vendors Pro - Add a custom link to your Pro Dashboard navigation bar */
add_filter( 'wcv_pro_dashboard_urls', 'custom_menu_link' );
function custom_menu_link( $pages ) {
$pages[ 'custom_link' ] = array(
'slug' => 'http://yoursite.com/customlink/here', // Change this to whatever you like, it must be a full URL
'label' => __('My Custom Link', 'wcvendors-pro' ),
'actions' => array()
);
return $pages;
}
@bentasm1
bentasm1 / product-edit.php
Created January 6, 2016 02:07 — forked from digitalchild/product-edit.php
WC Vendors Pro Form Input Type Examples
<?php
/**
* Example text input with validation
*/
WCVendors_Pro_Form_Helper::input(
array(
'post_id' => $object_id,
'id' => '_wcv_custom_product_example_text_input',
'label' => __( 'Product Meta Text Input', 'wcvendors-pro' ),
@bentasm1
bentasm1 / functions.php
Last active January 12, 2017 16:30 — forked from digitalchild/functions.php
How to make a field required in WC Vendors Pro
To require, or not to require, that is the question...... In the future, we'll make these into checkboxes to require/not require,
but for now you use filters. Add this code to your themes functions.php file. Here's the process:
1.) Find the filter for the field you want to adjust the requirements. This file is in /plugins/wc-vendors-pro/public/forms/class-wcvendors-pro-product-form.php
2.) Create a filter for each field you'd like to make required (or not required). The code below will make the description required:
/* WC Vendors Pro - Make Description Required */
function wcv_product_description_required( $args ) {
$args[ 'custom_attributes' ] = array(
@bentasm1
bentasm1 / functions.php
Created February 7, 2016 17:29 — forked from digitalchild/functions.php
WC Vendors Pro - Function to output vendor ratings/feedback in side bar
// Put this in your themes function.php
function vendor_feedback_sidebar() {
if ( is_shop() ) {
$vendor_shop = urldecode( get_query_var( 'vendor_shop' ) );
$vendor_id = WCV_Vendors::get_vendor_id( $vendor_shop );
if ( ! WCVendors_Pro::get_option( 'ratings_management_cap' ) ) echo WCVendors_Pro_Ratings_Controller::ratings_link( $vendor_id, true );
}
} // vendor_feedback_sidebar()
// call this in your side bar
@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">';
@bentasm1
bentasm1 / functions.php
Last active September 3, 2016 04:17 — forked from digitalchild/functions.php
WC Vendors Pro - Add another file uploader to the add/edit product form
/* WC Vendors Pro - Add another file uploader to upload a file with the ID in a meta key */
function custom_wcv_file_uploader( ){
$value = get_user_meta( get_current_user_id(), 'wcv_custom_product_file1', true ); // Must match meta key used in line 8
WCVendors_Pro_Form_Helper::file_uploader( array(
'header_text' => __('File uploader', 'wcvendors-pro' ),
'add_text' => __('Add file', 'wcvendors-pro' ),
'remove_text' => __('Remove file', 'wcvendors-pro' ),
'image_meta_key' => 'wcv_custom_product_file1', // Must match meta key used in line 3
'save_button' => __('Add file', 'wcvendors-pro' ),
'window_title' => __('Select an Image', 'wcvendors-pro' ),
@bentasm1
bentasm1 / functions.php
Created April 16, 2016 02:04 — forked from digitalchild/functions.php
Insert View my store in menu
<?php
// Hijack vendor menu to insert view store link.
function wcv_store_menu_link( $items, $args ) {
if ( WCV_Vendors::is_vendor( get_current_user_id() ) ) {
// Only insert the link in the menu you want based on the menu slug you define below.
// In this example a menu has been created called 'Vendor Menu' that has the menu slug vendor-menu
// This link will be the last link in the vendor menu