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 / 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;