Skip to content

Instantly share code, notes, and snippets.

View voboghure-dev's full-sized avatar
🏠
Working from home

Tapan Kumer Das voboghure-dev

🏠
Working from home
View GitHub Profile
/**
* For test and debug, log function to view any data in wp-content/debug.log
* uses: log_it($variable);
*
*/
if ( ! function_exists( 'log_it' ) ) {
function log_it( $message ) {
if ( WP_DEBUG === true ) {
if ( is_array( $message ) || is_object( $message ) ) {
error_log( "\r\n" . print_r( $message, true ) );
$ npx npm-check-updates -u
$ npm install
@voboghure-dev
voboghure-dev / Change file and folder permission
Created October 29, 2021 17:03
Linux command to change file and folder permission recursively
// from current folder and all its sub folder
find . -type d -exec chmod 0755 {} \;
find . -type f -exec chmod 0644 {} \;
/*
* Set up your Git configuration
*/
git config --global user.email "you@yourdomain.com"
git config --global user.name "Your Name"
git config --global core.editor "nano"
@voboghure-dev
voboghure-dev / functions.php
Last active February 23, 2021 03:52
Use a checkbox in checkout page to chose customer send a mail for subscription
/**
* Add WooCommerce Checkbox checkout
*/
function tkd_add_checkout_checkbox() {
woocommerce_form_field( 'checkout-checkbox', array( // CSS ID
'type' => 'checkbox',
'class' => array('form-row mycheckbox'), // CSS Class
'label_class' => array('woocommerce-form__label woocommerce-form__label-for-checkbox checkbox'),
'input_class' => array('woocommerce-form__input woocommerce-form__input-checkbox input-checkbox'),
$arrayOne = Array
(
"_wvs_pro_swatch_option" => Array
(
"default_to_button" => "yes",
"default_to_image" => "yes",
"default_image_type_attribute" => "",
"pa_color" => Array
(
"default_type" => "select",
/** Register custom product type */
add_action( 'init', 'register_gwp_bundle_product_type' );
function register_gwp_bundle_product_type () {
class WC_Product_gwp_bundle extends WC_Product {
public function __construct( $product ) {
$this->product_type = 'gwp_bundle';
parent::__construct( $product );
}
}
@voboghure-dev
voboghure-dev / gist:fcb0f5769c4822ea6c0f
Last active August 29, 2015 14:26 — forked from billerickson/gist:3698476
WP: Query $args
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query
* Source: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/query.php
*/
$args = array(
/**
* Helvetica Neue Normal (No Stretch)
*/
/* Helvetica Neue Black Font Stack */
.{font-family: "HelveticaNeueBlack", "HelveticaNeue-Black", "Helvetica Neue Black", "HelveticaNeue", "Helvetica Neue", 'TeXGyreHerosBold', "Arial Black", sans-serif; font-weight:800; font-stretch:normal;}
/* Helvetica Neue Heavy Font Stack */
.{font-family: "HelveticaNeueHeavy", "HelveticaNeue-Heavy", "Helvetica Neue Heavy", "HelveticaNeue", "Helvetica Neue", 'TeXGyreHerosBold', "Arial Black", sans-serif; font-weight:700; font-stretch:normal;}
<pre><?php
// WordPress Multisite - Delete all revisions from all posts in a netword.
// Quick hack by @mrazzari, 2014.
// For context see this thread started by Kitchin at the forums:
// http://wordpress.org/support/topic/deleting-post-revisions-do-not-use-the-abc-join-code-you-see-everywhere
// HOWTO
// This snippet is meant to be called as a standalone script.
// Like http://example.com/tmp/multisite_delete_revisions.php