Skip to content

Instantly share code, notes, and snippets.

😴
probably sleeping

Muhammad Rizwan mrizwan47

View GitHub Profile
View Dashicons array with glyph code
<?php
$dashicons = array(
'&#xf333;' => 'dashicons-menu',
'&#xf319;' => 'dashicons-admin-site',
'&#xf226;' => 'dashicons-dashboard',
'&#xf109;' => 'dashicons-admin-post',
'&#xf104;' => 'dashicons-admin-media',
'&#xf103;' => 'dashicons-admin-links',
'&#xf105;' => 'dashicons-admin-page',
'&#xf101;' => 'dashicons-admin-comments',
@mrizwan47
mrizwan47 / wc_change_sales_price.php
Last active Dec 6, 2018
Change woocommerce sales price programmatically
View wc_change_sales_price.php
<?php
// Your Product ID
$product_id = 57;
$ecd_product = new WC_Product( $product_id );
/**
* Check if product exists
*/
if( $ecd_product->exists() ){
@mrizwan47
mrizwan47 / delete-all-woocommerce-products.php
Last active Oct 14, 2016 — forked from mikaelz/delete-all-woocommerce-products.php
Remove all WooCommerce products from database via SQL
View delete-all-woocommerce-products.php
<?php
global $wpdb;
$wpdb->query("DELETE FROM $wpdb->terms WHERE term_id IN (SELECT term_id FROM $wpdb->term_taxonomy WHERE taxonomy LIKE 'pa_%')");
$wpdb->query("DELETE FROM $wpdb->term_taxonomy WHERE taxonomy LIKE 'pa_%'");
$wpdb->query("DELETE FROM $wpdb->term_relationships WHERE term_taxonomy_id not IN (SELECT term_taxonomy_id FROM $wpdb->term_taxonomy)");
$wpdb->query("DELETE FROM $wpdb->term_relationships WHERE object_id IN (SELECT ID FROM $wpdb->posts WHERE post_type IN ('product','product_variation'))");
$wpdb->query("DELETE FROM $wpdb->postmeta WHERE post_id IN (SELECT ID FROM $wpdb->posts WHERE post_type IN ('product','product_variation'))");
$wpdb->query("DELETE FROM $wpdb->posts WHERE post_type IN ('product','product_variation')");
$wpdb->query("DELETE pm FROM $wpdb->postmeta pm LEFT JOIN $wpdb->posts wp ON wp.ID = pm.post_id WHERE wp.ID IS NULL");
@mrizwan47
mrizwan47 / php-html-css-js-minifier.php
Last active Aug 19, 2016 — forked from tovic/php-html-css-js-minifier.php
PHP Function to Minify HTML, CSS and JavaScript
View php-html-css-js-minifier.php
<?php
/**
* ----------------------------------------------------------------------------------------
* Based on `https://github.com/mecha-cms/mecha-cms/blob/master/engine/plug/converter.php`
* ----------------------------------------------------------------------------------------
*/
You can’t perform that action at this time.