Skip to content

Instantly share code, notes, and snippets.

View chandra10207's full-sized avatar
🏠
Working from home

Chandra Shekhar Pandey chandra10207

🏠
Working from home
View GitHub Profile
@chandra10207
chandra10207 / gist:59e43d6ccf26c67ea7be4ec7a2dd8b42
Created June 23, 2017 04:36 — forked from robdvr/gist:7451695
Adding Bootstrap Forms to WooCommerce
add_filter('woocommerce_billing_fields', 'custom_woocommerce_billing_fields');
function custom_woocommerce_billing_fields( $fields ) {
$fields['billing_address_1']['class'] = array( 'form-group' );
$fields['billing_address_1']['input_class'] = array( 'form-control' );
return $fields;
}
<?php
/*
Description: Adds a taxonomy filter in the admin list page for a custom post type.
Written for: http://wordpress.stackexchange.com/posts/582/
By: Mike Schinkel - http://mikeschinkel.com/custom-workpress-plugins
Instructions: Put this code in your theme's functions.php file or inside your own plugin. Edit to suite your post types and taxonomies. Hope this helps...
*/
add_filter('manage_listing_posts_columns', 'add_businesses_column_to_listing_list');
function add_businesses_column_to_listing_list( $posts_columns ) {
if (!isset($posts_columns['author'])) {
@chandra10207
chandra10207 / woocommerce-login-logout-redirects.php
Created August 15, 2017 05:29 — forked from gbot/woocommerce-login-logout-redirects.php
WP: Redirect to home page for WooCommerce login and logout. #ST3
/*----------------------------------------------------------------------------*/
// redirects for login / logout
/*----------------------------------------------------------------------------*/
add_filter('woocommerce_login_redirect', 'login_redirect');
function login_redirect($redirect_to) {
return home_url();
}
@chandra10207
chandra10207 / functions.php
Created August 31, 2017 09:20 — forked from bentasm1/functions.php
Custom Taxonomy
<?php
// This code goes in your theme's functions.php
function form_caracteristica( $object_id ) {
WCVendors_Pro_Form_helper::select( array(
'post_id' => $object_id,
'id' => 'wcv_custom_product_caracteristicas',
'class' => 'select2',
'label' => __('Caracteristicas', 'wcvendors-pro'),
'show_option_none' => __('Select a caracteristicas', 'wcvendors-pro'),
@chandra10207
chandra10207 / functions.php
Created December 1, 2017 01:23 — forked from bentasm1/functions.php
WC Vendors Pro - Add new tabs to Pro Dashboard Navigation
/* WC Vendors Pro - Add some new page links to the Pro Dashboard */
function new_dashboard_pages( $pages ){
$pages[] = array( 'label' => 'New Link', 'slug' => 'http://mysomelink.com' ); // Add stuff here
return $pages;
}
add_filter( 'wcv_pro_dashboard_urls', 'new_dashboard_pages' );
@chandra10207
chandra10207 / wp_disable_passgenerator.php
Created January 19, 2018 04:30
When resetting passwords in WordPress a random password is automatically generated and pre-filled in the password field. to disable random password for password resets use this code.
add_filter( 'random_password', 'itsg_disable_random_password', 10, 2 );
function itsg_disable_random_password( $password ) {
$action = isset( $_GET['action'] ) ? $_GET['action'] : '';
if ( 'wp-login.php' === $GLOBALS['pagenow'] && ( 'rp' == $action || 'resetpass' == $action ) ) {
return '';
}
return $password;
@chandra10207
chandra10207 / wp.sh
Created February 26, 2020 10:37 — forked from bgallagh3r/wp.sh
Wordpress: Bash Install Script -- Downloads latest WP version, updates wp-config with user supplied DB name, username and password, creates and CHMOD's uploads dir, copies all the files into the root dir you run the script from, then deletes itself!
#!/bin/bash -e
clear
echo "============================================"
echo "WordPress Install Script"
echo "============================================"
echo "Database Name: "
read -e dbname
echo "Database User: "
read -e dbuser
echo "Database Password: "
@chandra10207
chandra10207 / woo-product-attributes-bulk-modifier.php
Created May 1, 2022 23:50 — forked from birgire/woo-product-attributes-bulk-modifier.php
WordPress: WooCommerce Product Attributes - Bulk Modifier ( from custom meta attributes to taxonomy attributes)
<?php
/**
* Plugin Name: WooPAM: Woo Product Attributes Modifier
* Description: Bulk update 'custom meta product attributes' to 'taxonomy product attributes' in WooCommerce. Supports the GET variables, like: woopam_mode=run&woopam_from_attribute_meta=colour&woopam_to_attribute_tax=pa_colour&woopam_keep_attribute_meta&woopam_posts_per_page=10&woopam_paged=0&woopam_post_type=product&woopam_post_status=any. WARNING: Backup DB first!!!
* Plugin Author: birgire
* Author URI: https://github.com/birgire
* Plugin URI: https://gist.github.com/birgire/0ed300ae4436fcaf508c
* Version: 1.0.0
* License: GPL2+
* Text Domain: woopam

Source

Vim Commands Cheat Sheet


How to Exit

:q[uit]

MySQL Cheat Sheet

Help with SQL commands to interact with a MySQL database

MySQL Locations

  • Mac /usr/local/mysql/bin
  • Windows /Program Files/MySQL/MySQL version/bin
  • Xampp /xampp/mysql/bin

Add mysql to your PATH