Skip to content

Instantly share code, notes, and snippets.

@faysalmahamud
faysalmahamud / functions.php
Created October 26, 2020 07:32 — forked from maddisondesigns/functions.php
WooCommerce Custom Fields for Simple & Variable Products
/*
* Add our Custom Fields to simple products
*/
function mytheme_woo_add_custom_fields() {
global $woocommerce, $post;
echo '<div class="options_group">';
// Text Field
@faysalmahamud
faysalmahamud / delete-all-woocommerce-products.php
Created September 8, 2020 05:12 — forked from mikaelz/delete-all-woocommerce-products.php
Remove all WooCommerce products from database via SQL
<?php
require dirname(__FILE__).'/wp-blog-header.php';
$wpdb->query("DELETE FROM wp_terms WHERE term_id IN (SELECT term_id FROM wp_term_taxonomy WHERE taxonomy LIKE 'pa_%')");
$wpdb->query("DELETE FROM wp_term_taxonomy WHERE taxonomy LIKE 'pa_%'");
$wpdb->query("DELETE FROM wp_term_relationships WHERE term_taxonomy_id not IN (SELECT term_taxonomy_id FROM wp_term_taxonomy)");
$wpdb->query("DELETE FROM wp_term_relationships WHERE object_id IN (SELECT ID FROM wp_posts WHERE post_type IN ('product','product_variation'))");
$wpdb->query("DELETE FROM wp_postmeta WHERE post_id IN (SELECT ID FROM wp_posts WHERE post_type IN ('product','product_variation'))");
$wpdb->query("DELETE FROM wp_posts WHERE post_type IN ('product','product_variation')");
'use strict'; // avoid ambiguity and sloppy errors
/**
* Tests whether or not a given string is a Palindrome
* @param {string} stringToTest - the string to test.
*/
function isPalindrome(stringToTest) {
var start = 0,
end;
@faysalmahamud
faysalmahamud / virtualhost
Last active March 4, 2017 13:08
Virtualhost Manage Script For Shell
#inspired from https://github.com/RoverWire/virtualhost
# Make a file named virtualhost and place it in /usr/local/bin folder.
# Give +x permission to the file.
# use as
# command create, existing, delete
# virtualhost command sitename.fmt folder_path virtual_host_name
# i.e virtualhost create example.fmt /var/www/example //create new domain
# this will create site-available folder example.com.conf