Skip to content

Instantly share code, notes, and snippets.

View vapvarun's full-sized avatar
👋
AI Developer & WordPress Expert. Building MCP servers & Plugins

Varun Kumar Dubey vapvarun

👋
AI Developer & WordPress Expert. Building MCP servers & Plugins
View GitHub Profile
@vapvarun
vapvarun / gist:6d24092cb775f8bdf17463014cabb564
Last active April 26, 2016 07:42 — forked from strangerstudios/gist:3111478
Lockdown BuddyPress with Paid Memberships Pro Example
<?php
/*
Plugin Name: PMPro BuddyPress Customizations
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-buddypress-customizations/
Description: Example code to lock down parts of BuddyPress with PMPro
Version: 0.2
Author: Stranger Studios
Author URI: http://www.strangerstudios.com
*/
/*
@vapvarun
vapvarun / 0_reuse_code.js
Created December 17, 2016 05:38
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@vapvarun
vapvarun / wc-exclude-product-category-from-shop-page.php
Created May 10, 2021 06:05
Exclude products from a particular category on the shop page
/**
* Exclude products from a particular category on the shop page
*/
function wb_custom_pre_get_posts_query( $q ) {
$tax_query = (array) $q->get( 'tax_query' );
$tax_query[] = array(
'taxonomy' => 'product_cat',
'field' => 'slug',
@vapvarun
vapvarun / assignment-list-shortcode.php
Last active November 28, 2023 09:42
Assignment List Shortcode
/**
* Learndash Assignment List Shortcode
*
* This shortcode generates a table listing SFWD assignments with title, author, publish date, and file information.
* Admin users can view all assignments, while other logged-in users can only view their own assignments.
*/
function ld_dashboard_add_nav_menu( $menu_items ) {
$menu_items['all']['custom'] = array(
'url' => get_the_permalink() . '?tab=student-assignment', // tab=custom sets the slug of your custom tab which will later be used to display content in this tab.
@vapvarun
vapvarun / gist:9782a66e3bf7be6b4b4b3e2a4e05470e
Created January 7, 2025 05:20
ld_dashboard_add_nav_menu
function ld_dashboard_add_nav_menu( $menu_items ) {
$menu_items['all']['hello-world'] = array(
'url' => get_the_permalink() . '?tab=hello-world',
'icon' => '<img src="https://via.placeholder.com/24" alt="Hello World Icon">',
'label' => 'Hello World',
);
return $menu_items;
}
add_filter( 'learndash_dashboard_nav_menu', 'ld_dashboard_add_nav_menu', 10, 1 );
@vapvarun
vapvarun / gist:85beaa5b6afe2ef99d7cef0623fe9974
Created March 4, 2025 18:30
Remove the "Reviews" tab from the Business Profile menu in BuddyPress
/**
* Remove the "Reviews" tab from the Business Profile menu in BuddyPress.
*
* This function hooks into `bp_business_profile_single_menu_items` to
* dynamically remove the "Reviews" tab while ensuring compatibility.
*
* @since 1.0.0
* @author Your Name
*/
@vapvarun
vapvarun / login-register-popup-guide.md
Created August 21, 2025 05:04
Reign Theme Login/Register Popup Integration Guide - How to trigger login and register popups from anywhere in WordPress

Reign Theme Login/Register Popup Integration Guide

Overview

The Reign theme provides a built-in login/register popup system that can be triggered from anywhere on your site. This guide explains how to integrate these popups into custom links and buttons.

How It Works

Core Implementation

The theme uses JavaScript event handlers to detect clicks on specific elements and opens a modal popup containing login/registration forms.

@vapvarun
vapvarun / wbbpp-dropdown-sorting-snippet.php
Created August 22, 2025 05:27
BuddyPress Profile Pro - Alphabetical Dropdown Sorting - Automatically sorts dropdown options alphabetically
<?php
/**
* BuddyPress Profile Pro - Alphabetical Dropdown Sorting (Code Snippet)
*
* Add this code to your theme's functions.php file or use a code snippet plugin
* like Code Snippets, WPCode, or Advanced Scripts
*
* This snippet automatically sorts all dropdown, checkbox, radio button, and
* selectize field options alphabetically in BuddyPress Profile Pro
*/
@vapvarun
vapvarun / README.md
Last active August 27, 2025 17:10
AffiliateWP - Add Desired Coupon Code Field with Auto-Association for WooCommerce

AffiliateWP - Desired Coupon Code Field with WooCommerce Integration

A single-file solution that adds a custom "Desired Coupon Code" field to AffiliateWP registration forms with automatic WooCommerce coupon creation and tracking.

Features

✅ Custom coupon code field on affiliate registration
✅ Automatic WooCommerce coupon creation when affiliate is approved
✅ Coupon-affiliate association for referral tracking
✅ Input validation (3-20 chars, alphanumeric + hyphens/underscores)

@vapvarun
vapvarun / README.md
Created August 27, 2025 17:11
AffiliateWP - Desired Coupon Code Field (Single File Solution)

AffiliateWP - Desired Coupon Code Field with WooCommerce Integration

A single-file solution that adds a custom "Desired Coupon Code" field to AffiliateWP registration forms with automatic WooCommerce coupon creation and tracking.

Features

✅ Custom coupon code field on affiliate registration
✅ Automatic WooCommerce coupon creation when affiliate is approved
✅ Coupon-affiliate association for referral tracking
✅ Input validation (3-20 chars, alphanumeric + hyphens/underscores)