Skip to content

Instantly share code, notes, and snippets.

View fervous's full-sized avatar

Anna fervous

View GitHub Profile
@fervous
fervous / gist:44178b88d9c51a9b294d898b32294f61
Created August 16, 2016 01:49
filter add text to wc vendors pro product-edit.php
add_filter('wcv_product_upsells', 'custom_wcv_product_upsells');
function custom_wcv_product_upsells( $args ){
$args['label'] = 'Up-Sells <span style ="font-size:11px; font weight:normal;">Your message here.......</span>';
return $args;
}
@fervous
fervous / wc vendors pro - vendor product meta icon & link php for functions.php
Last active August 25, 2016 03:18
vendor icon and links for meta products page
@fervous
fervous / gist:3b36fefac27fed7bb623dd60f35540bc
Created September 1, 2016 21:56
product description working - store description not working
add_filter('wcv_product_description', 'custom_wcv_product_description');
function custom_wcv_product_description( $args ){
$args['label'] = 'PRODUCT DESCRIPTION <br><i class="fa fa-info-circle" aria-hidden="true"></i><span style ="font-size:11px; font weight:400;"> REQUIRED. Describe your product in detail for your customers. Include size, materials &amp; any relevant information here.</span>';
return $args;
}
add_filter('wcv_vendor_store_description', 'custom_wcv_vendor_store_description');
function custom_wcv_vendor_store_description( $args ){
$args['label'] = 'SHOP DESCRIPTION <br><i class="fa fa-info-circle" aria-hidden="true"></i><span style ="font-size:11px; font weight:400;">Optional. Give a brief, keyword-rich description of your shop. This is used with SEO. This will be shown under your shop banner on your storefront.</span>';
@fervous
fervous / product-edit.php
Created September 2, 2016 23:42
Ensure Paypal is entered BEFORE a product can be listed
<?php
/**
* The template for displaying the Product edit form
*
* Override this template by copying it to yourtheme/wc-vendors/dashboard/
*
* @package WCVendors_Pro
* @version 1.3.2
*/
/**
@fervous
fervous / gist:2437ee5944015f6436af27e76641e8a4
Created September 3, 2016 03:02 — forked from bentasm1/gist:8cd5706b6bc6194e0ea4f5e8f487e32d
Warn vendors if they dont have some custom field set
/* This will warn a vendor if some magical meta key isnt set. Change it to the one you need in the code below: */
// Get the users meta key we want to check.
$the_meta_key = get_user_meta( get_current_user_id(), 'CHANGEME', true ); // CHANGE CHANGEME TO THE META KEY NAME YOU WANT TO CHECK.
// DEBUG STUFF. UNCOMMENT TO CHECK STUFF.
// echo '<pre>THE META KEY IS: ' . $the_meta_key . '</pre>';
// Check if meta key is set
if (!isset($the_meta_key)) {
@fervous
fervous / functions.php
Created September 3, 2016 03:40 — forked from bentasm1/functions.php
WC Vendors Pro - Change "Settings" on Pro Dashboard to another name
/* WC Vendors Pro - Change the Settings tab on the Pro Dashboard navigation to say "New Label" (or whatever) instead */
function custom_menu_link( $pages ) {
$pages[ 'settings' ] = array(
'slug' => 'settings',
'label' => __('New Label', 'wcvendors-pro' ),
'actions' => array()
);
return $pages;
}
@fervous
fervous / functions.php
Created September 3, 2016 03:41 — forked from bentasm1/functions.php
WC Vendors Pro - Use Vendor Store Icon as Yoast SEO OpenGraph
// Set Vendors Store Icon as Open Graph image on shop page
function my_opengraph_image( $img ) {
if ( WCV_Vendors::is_vendor_page() ) {
$vendor_shop = urldecode( get_query_var( 'vendor_shop' ) );
$vendor_id = WCV_Vendors::get_vendor_id( $vendor_shop );
$store_icon_src = wp_get_attachment_image_src( get_user_meta( $vendor_id, '_wcv_store_icon_id', true ), 'full' );
// see if the array is valid
if ( is_array( $store_icon_src ) ) {
$img = $store_icon_src[0];
@fervous
fervous / functions.php
Created September 3, 2016 03:43 — forked from bentasm1/functions.php
WC Vendors Pro - Add new tabs to Pro Dashboard Navigation
/* WC Vendors Pro - Add some new page links to the Pro Dashboard */
function new_dashboard_pages( $pages ){
$pages[] = array( 'label' => 'New Link', 'slug' => 'http://mysomelink.com' ); // Add stuff here
return $pages;
}
add_filter( 'wcv_pro_dashboard_urls', 'new_dashboard_pages' );
@fervous
fervous / functions.php
Created September 3, 2016 03:44 — forked from bentasm1/functions.php
WC Vendors - Show vendors products in BuddyPress
/* Code by Fervous
* WC Vendors - Shows a "My Products" tab in BuddyPress and then the vendors products in that tab
*/
function my_bp_nav_adder() {
if (class_exists('WC_Vendors')) {
$wcv_profile_id = bp_displayed_user_id();
$wcv_profile_info = get_userdata( bp_displayed_user_id() );
if ( $wcv_profile_info->roles[0] == "vendor" ) {
@fervous
fervous / functions.php
Created September 3, 2016 03:45 — forked from bentasm1/functions.php
WC Vendors Pro Bank & IBAN Details
/* WC Vendors Pro - My Custom Bank Fields */
function store_bank_details( ){
if ( class_exists( 'WCVendors_Pro' ) ){
$key = '_wcv_custom_settings_bankname';
$value = get_user_meta( get_current_user_id(), $key, true );
// Bank Name
WCVendors_Pro_Form_Helper::input( array(
'id' => $key,
'label' => __( 'Banküberweisung als Auszahlungs Methode Ihres Provision verwenden', 'wcvendors-pro' ),
'placeholder' => __( 'Bank Name', 'wcvendors-pro' ),