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
@jan-koch
jan-koch / remove-woo-scripts.php
Created February 28, 2020 09:14
Remove WooCommerce related resources except on WooCommerce-based pages (products, cart, checkout, etc). Use on a testing environment before pasting this into your live website!
/**
* This code snippet removes JavaScript and CSS files loaded from WooCommerce if they are not necessary.
*
* Please test this on a staging copy of your website before putting this into the functions.php of your live website.
*/
add_action( 'wp_enqueue_scripts', 'my_remove_woo_assets', 99 );
function my_remove_woo_assets() {
if ( function_exists( 'is_woocommerce' ) ) { // Check if Woo is installed.
if ( ! is_woocommerce() && ! is_cart() && ! is_checkout() ) { // Only run on non-Woo pages.
// Remove unnecessary stylesheets.
@wbcomdev
wbcomdev / class-referrals-reports-tab.php
Created July 25, 2018 18:06
Affiliate Total Unpaid Earning tile
Please navigate to file includes/admin/reports/tabs/class-referrals-reports-tab.php and replace the total unpaid earning tile code with the following code:
$total_unpaid_earnings = 0;
$referrals = affiliate_wp()->referrals->get_referrals( array(
'number' => -1,
'status' => 'unpaid',
'affiliate_id' => $this->affiliate_id,
'date' => $this->date_query ? $this->date_query : ''
) );
foreach ( $referrals as $referral ) {
@justintadlock
justintadlock / parent-theme-mod-fallback.php
Last active June 20, 2021 22:38
Get theme mods that fall back to the stored parent theme mod if child theme is active.
<?php
/**
* The purpose of this code is to show how you can use theme mods that will fall back to
* the already-set mods of the parent theme. So, when a child theme is active, the code
* checks, in the following order: 1) child theme mod, 2) parent theme mod, 3) default.
*/
function jt_get_theme_mod( $name, $default = false ) {
if ( is_child_theme() )
@shanebp
shanebp / BP_Group_Extension-example
Last active May 26, 2021 16:26
example of using BP_Group_Extension
/* example of using BP_Group_Extension
* replace 'test' with something else - remember that it is case-sensitive
* checks for any selected Group Types in the 'Settings' step
*/
function test_add_group_extension() {
if ( bp_is_active( 'groups' ) ) :