Skip to content

Instantly share code, notes, and snippets.

View fida02's full-sized avatar
🏠
Working from home

Fida Al Hasan fida02

🏠
Working from home
View GitHub Profile
@fida02
fida02 / wpmu-hb-ao-elementor-css-fix.php
Created May 9, 2026 04:20
Exclude Elementor CSS files from Hummingbird’s asset optimization, ensuring the styles load in the correct sequence
<?php
/**
* Plugin Name: [WPMUDEV Forum] Hummingbird Asset Optimization and Elementor CSS Conflict Fix
* Plugin URI: https://wpmudev.com
* Description: Hummingbird Asset Optimization was loading Elementor CSS in an incorrect order. This MU plugin resolves the issue by excluding Elementor CSS from Hummingbird’s asset optimization, ensuring the styles load in the correct sequence.
* Author: Fida Al Hasan
* Author URI: https://wpmudev.com/
*/
add_action( 'plugins_loaded', function() {
@fida02
fida02 / ssh-migration-website.txt
Created June 8, 2024 19:48
SSH command list for website migration between servers
# Source server commands #
# Database backup
mysqldump -u USER -pPASSWORD DATABASENAME > mydb.sql
# Zip all files and database backup
zip -r mysite.zip .
# Destination server commands #
# Download the zip file to the destination
wget https://mywebsiteaddress.com/mysite.zip
@fida02
fida02 / forminator-disable-today-after-time-datepicker.php
Last active June 5, 2024 05:20
This will disable today date selection of Forminator Datepicker after 8 am
<?php
/**
* Plugin Name: [Forminator] - Disable today on datepicker after specific time
* Plugin URI: https://wpmudev.com/project/forminator-pro/
* Description: Disable today date selection on the Forminator Datepicker after 8 am.
* Author: Fida Al Hasan @ WPMUDEV
* Author URI: https://wpmudev.com/
* License: GPLv2 or later
*/
@fida02
fida02 / wpmudev.css
Last active August 9, 2022 20:25
WPMUDEV Task CSS
/**
* Header Section
*/
.wp-elements-6168ec0dc787a297453884a052a8bf6d {
background-color: #6FABAC !important;
padding-bottom: 30px !important;
}
.wp-elements-6168ec0dc787a297453884a052a8bf6d .wp-container-3 {
padding-top: 10px !important;
}
@fida02
fida02 / wpmudev-unique-id.php
Last active August 9, 2022 20:34
WPMUDEV Unique customer ID Task
<?php
/**
* Unique customer ID
*
* @return string
*/
function wpmu_unique_id() {
// Get current user object
$current_user = wp_get_current_user();
@fida02
fida02 / runcloud-php-apcu
Created July 26, 2022 20:54
Installing the PHP-APCU for RunCloud Linux
## Install Tools
sudo apt install autoconf libpcre3-dev -y
## Define Module Name and Version
MODULE_NAME="apcu"
MODULE_VERSION="5.1.21"
## Download and Unzip Extensions
wget https://pecl.php.net/get/$MODULE_NAME-$MODULE_VERSION.tgz
tar -zxvf $MODULE_NAME-$MODULE_VERSION.tgz
@fida02
fida02 / migrate-wp-data.php
Last active March 4, 2022 19:50
Change custom post type name, custom taxonomy name and runc the function once
<?php
/**
* Migrate data from v2.0.4 to v2.1.0
*
* run once
*/
function fida_migrate_data() {
if ( get_option( 'fida_migrate_data_204' ) < 1 ) {
global $wpdb;
<?php
// Save referrer url in cookie
function set_referrer_cookie() {
$cookie_value = $_SERVER['HTTP_REFERER'] ?? null; // Get URL the user came to your site for
if ( !is_admin() && !isset($_COOKIE['origin'])) { // If not an admin or if cookie doesn't exist already
setcookie( 'origin', $cookie_value, time()+3600*24*30, COOKIEPATH, COOKIE_DOMAIN, false); // Set cookie for 30 days
}
}
@fida02
fida02 / woocommerce-add-gift.php
Last active August 2, 2021 10:47
WooCommerce Automatically add a gift product when customer purchase anything
<?php
/*
* Automatically add a gift product when customer purchase anything.
* Use: Add this code in your theme's function.php file
*/
function fida_add_gift_product_to_cart() {
global $woocommerce;
$cart_total = 1;