Skip to content

Instantly share code, notes, and snippets.

@wpweb101
wpweb101 / update-role.php
Last active June 28, 2018 07:04
Update vendor role title in woo pdf voucher
<?php // Do not add this if it's already added.
function woo_vou_change_vendor_role_name() {
//get vendor role
$vendor_role = get_role( WOO_VOU_VENDOR_ROLE );
if( !empty( $vendor_role ) ) { // if already added vendor role
// first remove vendor role
remove_role( WOO_VOU_VENDOR_ROLE );
@wpweb101
wpweb101 / functions.php
Last active December 3, 2015 09:04
Disable enfold theme builder functionality in voucher templates CPT
<?php
//Create global variable for builder
global $builder_object;
//Assign builder object to global variable
$builder_object = $builder;
//Add action for remove builder functionality from voucher templates
add_action( 'admin_init', 'avia_remove_builder_functionality' );
@wpweb101
wpweb101 / author-follow-on-vendor-shop-page.php
Last active August 29, 2015 14:19
Follow my blog post - Add author follow button on frontend submission vendor shop page in maketify theme
<?php
// add action to add author follow button
add_action( 'marketify_vendor_profile_after_sales', 'wpw_fp_author_follow_button' );
function wpw_fp_author_follow_button() {
$author_slug = get_query_var( 'vendor' );
@wpweb101
wpweb101 / link-author-name-to-vendor-shop-page.php
Created April 24, 2015 09:47
Follow my blog post - link author name to vendor shop page url in frontend submission
@wpweb101
wpweb101 / woo-term-follow-button.php
Last active January 11, 2019 14:21
Add Follow button on woocommerce category archive and tag archive pages
<?php
function wpw_fp_woocommerce_archive_follow() {
if ( is_product_taxonomy() ) {
$term = get_queried_object();
$taxonomy_type = isset( $term->taxonomy ) ? $term->taxonomy : '';
$taxonomy_id = isset( $term->term_id ) ? $term->term_id : '';
@wpweb101
wpweb101 / woo-vou-custom-pdf-size.php
Last active September 28, 2015 13:06
woocommerce pdf voucher - Add Custom Pdf size
<?php
// For add custom PDF
function woo_vou_add_custom_pdf_sizes( $pdf_sizes = array() ) {
$pdf_sizes = array_merge( $pdf_sizes, array(
'A_Custom' => array(
'width' => 500,
'height' => 500,
'fontsize' => 50
@wpweb101
wpweb101 / woo-vou-vender-can-redeem-all.php
Last active August 29, 2015 14:23
Woo PDF vouchers - vendor can redeem all voucher codes
<?php
function woo_vou_vendor_can_redeem_all_codes( $roles = array() ) {
$roles[] = 'shop_manager';
// you can add this code if you want to allow vendor role to check all voucher codes and other report pages
//$roles[] = 'woo_vou_vendors';
return $roles;
@wpweb101
wpweb101 / follow-to-email-issue.php
Last active August 29, 2015 14:24
Follow My Blog Post - Server To Email issue
<?php
// Note : If you still do not get mail then please write any email id instead of '$fromemail'
// Please add the below code to your theme functions file.
function wpw_fp_set_email_to( $email, $fromemail ) {
$email = $fromemail; // any custom email id, if you do not getting any mail
return $email;
}
@wpweb101
wpweb101 / edd-img-wtm-jpeg-quality.php
Created July 16, 2015 09:03
Edd Download Image Watermark - JPEG image quality
<?php
/**
* Function to handle the download image jpeg quality
* Note : Value should be numeric and bettween 0 to 100
*
* @param int $quality
* @return $quality
*/
function edd_img_wtm_jpeg_quality( $quality ) {
@wpweb101
wpweb101 / edd-img-wtm-png-quality.php
Created July 16, 2015 09:07
Edd Download Image Watermark - PNG image quality
<?php
/**
* Function to handle the download image png quality
* Note : Value should be numeric and bettween 0 to 9
*
* @param int $quality
* @return $quality
*/
function edd_img_wtm_png_quality( $quality ) {