Type: php
TGT Login Logo Script to replace plugin
// Changes the URL of the login logo to the home URL of the site function my_custom_login_url() { return home_url(); } add_filter(‘login_headerurl’, ‘my_custom_login_url’); // Changes the hover text of the login logo to the blog name function my_custom_login_title() { return…Continue reading
Custom Post Type “TGTBlog”
/* * Creating a function to create our CPT */ function custom_post_type() { // Set UI labels for Custom Post Type $labels = array( ‘name’ => _x( ‘TGTBlogs’, ‘Post Type General Name’, ‘neve’ ), ‘singular_name’ => _x( ‘TGTBlog’, ‘Post Type…Continue reading
Changes Posts to Client Portals
add_action( ‘admin_menu’, ‘change_post_menu_label’ ); function change_post_menu_label() { global $menu; global $submenu; // Loop through the menu items to find the one we want foreach ( $menu as $key => $value ) { if ( $value[0] == ‘Posts’ ) { //…Continue reading
MemberPress: Add Category Exception to All Post Rule
function mepr_override_protection( $protect, $post ) { if( has_category( ‘category_slug_here’, $post ) ) { $protect = false; } return $protect; } function mepr_override_content_protection( $protect, $post, $uri ) { return mepr_override_protection( $protect, $post ); } function mepr_override_redirection_protection( $protect, $uri, $delim ) {…Continue reading
Including product tax to commission calculation
add_filter( ‘wcvendors_commission_rate’, ‘wcv_calculate_commission_include_product_tax’, 10, 5 ); function wcv_calculate_commission_include_product_tax( $commission, $product_id, $product_price, $order, $qty ) { $product = new WC_Product( $product_id ); $product_price_include_tax = wc_get_price_including_tax( $product ); $commission_rate = WCV_Commission::get_commission_rate( $product_id ); $commission = $product_price_include_tax * ( $commission_rate / 100 );…Continue reading
change the name of the Commission column
if ( ! function_exists( ‘wcv_change_commission_table_columns_name’ ) ) { /** * Change the name of the commission table columns. * * @param array $columns Columns. * @return array */ function wcv_change_commission_table_columns_name( $columns ) { $columns[‘total_due’] = __( ‘Whatever’, ‘wc-vendors’ ); return…Continue reading
Hide “Everywhere Else” on the countries dropdown
if ( ! function_exists( ‘wcv_hide_everywhere_else’ ) ) { /** * Hide the “Everywhere else” option in the countries dropdown. * * @param array $regions Array of countries. */ function wcv_hide_everywhere_else( $regions ) { unset( $regions[‘EWE’] ); return $regions; } add_filter(…Continue reading
Add CSS classes to apply for vendor label
/** * Add CSS class to apply for vendor label in a registration * * @param string $class CSS classes. * @return string */ function wcv_add_apply_vendor_label_css_class( $class ) { $class .= ‘example_css_class’; return $class; } add_filter( ‘wcvendors_vendor_registration_apply_label_css_classes’, ‘wcv_add_apply_vendor_label_css_class’, 10, 1…Continue reading
Force product type for all products
// Disable the product type drop down. add_filter(‘wcv_disable_product_type’, function() { return true; } ); /** * Hook into the form and output a hidden field that sets the product type. */ add_action( ‘wcv_after_product_type’, ‘wcv_set_product_type’ ); function wcv_set_product_type( $object_id ){ WCVendors_Pro_Product_Form::product_type_hidden(…Continue reading