Skip to content

Instantly share code, notes, and snippets.

View codezz's full-sized avatar
🎯
Focusing

Gabriel F. codezz

🎯
Focusing
View GitHub Profile
@codezz
codezz / bp-restrict-pmpro-redirect-url.php
Last active March 4, 2021 09:22
Change BP Restrict PMPRO redirect URL
<?php
add_filter( 'bp_restrict_pmpro_url_redirect', 'bpr_change_bp_restrict_url' );
function bpr_change_bp_restrict_url( $url ) {
return 'https://mysite.com/login';
}
@codezz
codezz / buddybuilder-buddypress-custom-template.php
Created May 14, 2021 11:31
BuddyBuilder override template with Elementor canvas
<?php
/*
* This overrides BuddyBuilder template for BuddyPress pages with Elementor canvas template.
*/
add_filter( 'buddy_builder/page_template ', function ( $template ) {
if ( ! class_exists( '\Elementor\Plugin' ) ) {
return $template;
}
$page_templates_module = \Elementor\Plugin::$instance->modules_manager->get_modules( 'page-templates' );
@codezz
codezz / woo-require-coupon.php
Created November 15, 2021 20:02
Woocommerce mandatory coupon
function mandatory_coupon_code() {
$applied_coupons = WC()->cart->get_applied_coupons();
if ( empty ( $applied_coupons ) ) {
// Not found: display an error notice
wc_add_notice( __( 'Add coupon before checkout.', 'woocommerce' ), 'error' );
}
}
add_action( 'woocommerce_check_cart_items', 'mandatory_coupon_code', 10, 0 );
@codezz
codezz / dollie-launch-site-change-redirect.php
Last active December 12, 2022 16:33
Dollie redirect to URL on site launch
<?php
// Redirects directly after launch.
add_filter('dollie/launch_site/immediate_redirect', function ($redirect) {
$redirect = 'https://example.com/dashboard';
return $redirect;
});
// Redirects after the site has finished to launch. Happens on the site page when is loading.
add_filter('dollie/launch_site/redirect', function ($redirect) {
$redirect = 'https://example.com/dashboard';
@codezz
codezz / install.sh
Last active December 16, 2022 14:46
Compile ImageMagick with WEBP and HEIC support on Ubuntu 22.04
# install base dependencies
sudo apt-get install libwebp-dev libde265-dev
cd /usr/src
# install library for reading heif/heic files
wget https://github.com/strukturag/libheif/releases/download/v1.14.0/libheif-1.14.0.tar.gz
cd libheif-1.14.0
./autogen.sh
./configure
@codezz
codezz / remove-dollie-woo-thank-you-page-redirect.php
Created February 22, 2023 18:50
Remove Dollie redirect from Woocommerce thank you page
<?php
remove_action( 'woocommerce_thankyou', [ \Dollie\Core\Modules\Subscription\Plugin\WooCommerce::instance(), 'redirect_to_blueprint' ] );
@codezz
codezz / dollie-hub-adjust-login-redirect.php
Created November 8, 2024 10:25
Adjust Login redirect location for One click login inside Dollie Hub
<?php
add_filter('dollie/site/login_url/location', function($location, $container) {
return 'wp-admin/';
}, 10, 2);
@codezz
codezz / dollie-site-launcher-helper.php
Created November 21, 2024 07:56
Dollie WordPress Hub - Launch Site helper
<?php
/*
Plugin Name: Dollie Site Helper
Description: A helper plugin to launch Dollie sites.
Version: 1.0.0
Author: getdollie.com
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
@codezz
codezz / Motion Sensor and Switch Control.yaml
Last active January 21, 2025 20:38
Control a switch using a motion sensor with OFF/ON/AUTO modes.
blueprint:
name: Device Control with Mode Helper and Custom Actions
description: Control actions using any device's triggers with OFF/ON/AUTO modes.
domain: automation
input:
motion_occupied_trigger:
name: Occupied Trigger
description: Select the trigger for when motion/occupancy is detected
selector:
trigger: {}