Skip to content

Instantly share code, notes, and snippets.

View Asikur22's full-sized avatar
💜
Web Developer | In Love with WordPress

Asiqur Rahman Asikur22

💜
Web Developer | In Love with WordPress
View GitHub Profile
@Asikur22
Asikur22 / customroutes.php
Created December 20, 2022 09:52 — forked from samhernandez/customroutes.php
A simple class to add custom routes to Wordpress.
<?php
/**
* NOTE: This gist is very old. You might want to check out recent forks
* like this one: https://github.com/Alexlytle/Wordpress_custom_route/blob/main/Wordpress_Custom_route.php
* (thanks @Alexlytle) If you have an improvement to this gist, please
* post a link in a comment for others who might benefit. Thanks!
*
* A class to create simple custom routes.
*
@Asikur22
Asikur22 / wp-woocommerce-allow-non-variation-attributes-frontend-selection.php Woocommerce: use non-variation attributes from frontend - allow customers to select term (option) from non-variation attributes on variable or simple products frontend pages, add selection to cart item, display it in cart, add it to order item
<?php
/**
* Inspired from: https://gist.github.com/dazecoop/548b2621e86fb030da8e5adb1bfe484f
*
* How to use:
* - add to your function.php or related
*
* What you can use it for:
* Variable products:
* - you have variable product with some attributes not used for variations
@Asikur22
Asikur22 / watermark-image-uploads.php
Created January 1, 2022 04:49 — forked from Viper007Bond/watermark-image-uploads.php
Watermark WordPress Image Uploads
<?php
/*
* Plugin Name: WordPress.com Watermark Image Uploads
* Author: Alex Mills
* Author URI: http://automattic.com/
*/
class WPcom_Watermark_Uploads {
public $watermark;
@Asikur22
Asikur22 / tinker-post-config.sh
Created August 30, 2021 16:44 — forked from hartraft/tinker-post-config.sh
Configuration script after installing TinkerOS on ASUS Tinkerboard
#!/bin/bash
# My custom script to configuring TinkerOS post install as a desktop replacement. For personal use
sudo apt-get update
# disable swap to reduce SD card wear
sudo swapoff -a
# Setup numlockx for default numlock on at startup
sudo apt-get install numlockx
@Asikur22
Asikur22 / mailhog-postfix.MD
Created February 5, 2021 13:22 — forked from 0-Sony/mailhog-postfix.MD
MailHog + Postfix configuration on Mac Os (work on Mojave)

Configure MAILHOG and POSTFIX on MAC OS (Mojave)

INSTALL BREW

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

If brew is already installed

@Asikur22
Asikur22 / add_shipping_phone_to_order_emails.php
Created June 15, 2020 17:03 — forked from clifgriffin/add_shipping_phone_to_order_emails.php
Add CheckoutWC shipping phone number to WooCommerce order email.
<?php
// Do NOT include the opening php tag.
// Place in your theme's functions.php file
/**
* Add a custom field (in an order) to the emails
*/
add_filter( 'woocommerce_email_order_meta_fields', 'custom_woocommerce_email_order_meta_fields', 10, 3 );
function custom_woocommerce_email_order_meta_fields( $fields, $sent_to_admin, $order ) {
@Asikur22
Asikur22 / custom-permalink-from-meta.php
Created March 16, 2020 14:29 — forked from petenelson/custom-permalink-from-meta.php
WordPress permalink for custom post type based on post meta
@Asikur22
Asikur22 / .htaccess
Created January 16, 2020 04:32 — forked from alexander-young/.htaccess
WordPress - Increase maximum upload size
php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 300
@Asikur22
Asikur22 / functions.php
Created January 16, 2020 04:31 — forked from alexander-young/functions.php
Allow SVGs in WordPress media library
function upload_svg_files( $allowed ) {
if ( !current_user_can( 'manage_options' ) )
return $allowed;
$allowed['svg'] = 'image/svg+xml';
return $allowed;
}
add_filter( 'upload_mimes', 'upload_svg_files');
@Asikur22
Asikur22 / functions.php
Last active March 21, 2022 02:24 — forked from alexander-young/functions.php
Defer Javascript/CSS in WordPress
function defer_parsing_of_js($url)
{
if (is_admin()) return $url; //don't break WP Admin
if (false === strpos($url, '.js')) return $url;
if (strpos($url, 'jquery.js')) return $url;
return str_replace(' src', ' defer src', $url);
}
add_filter('script_loader_tag', 'defer_parsing_of_js', 10);