Skip to content

Instantly share code, notes, and snippets.

View mehedicsit's full-sized avatar

Mehedi Hasan mehedicsit

View GitHub Profile
@mehedicsit
mehedicsit / functions.php
Created February 3, 2016 04:53 — forked from fuyuko/functions.php
Cheatsheet - WooCommerce Customization in functions.php
//Add a stylesheet after default style.css
wp_enqueue_style( 'my-css', get_template_directory_uri() . 'my-css.css', array('themename-style'));
//WooCommerce - Sort products by SKU
add_filter('woocommerce_get_catalog_ordering_args', 'custom_woocommerce_catalog_orderby');
function custom_woocommerce_catalog_orderby( $args ) {
$args['meta_key'] = '_sku';
$args['orderby'] = 'meta_value';
$args['order'] = 'asc';
return $args;
function init_pmpro_membership_content_filter_later()
{
remove_filter('the_content', 'pmpro_membership_content_filter', 5);
remove_filter('the_content_rss', 'pmpro_membership_content_filter', 5);
remove_filter('comment_text_rss', 'pmpro_membership_content_filter', 5);
add_filter('the_content', 'pmpro_membership_content_filter', 15);
add_filter('the_content_rss', 'pmpro_membership_content_filter', 15);
add_filter('comment_text_rss', 'pmpro_membership_content_filter', 15);
}
@mehedicsit
mehedicsit / woocommerce-upsells-shortcode.php
Created September 22, 2017 19:26 — forked from bekarice/woocommerce-upsells-shortcode.php
WooCommerce Upsells Shortcode: outputs product upsells when the [woocommerce_product_upsells] shortcode is used
<?php
/**
* Plugin Name: WooCommerce Upsells Shortcode
* Plugin URI: http://skyver.ge/51
* Description: Adds a shortcode to output WooCommerce product upsells; removes them from the original location when used
* Author: SkyVerge
* Author URI: https://www.skyverge.com/
* Version: 1.0.0
*
* Copyright: (c) 2016 SkyVerge, Inc. (info@skyverge.com)
@mehedicsit
mehedicsit / mysqli_cheat.php
Created September 23, 2017 10:38
mysqli cheat sheet
<?php
Give me one record
$queryFilms = "SELECT filmName, filmDescription FROM movies WHERE filmID = 10";
$resultFilms = $mysqli->query($queryFilms);
$rowFilms = $resultFilms->fetch_assoc();
// then to output
echo "<p>{$rowFilms['filmName']}</p>";
@mehedicsit
mehedicsit / functions.php
Created September 24, 2017 11:36 — forked from lukecav/functions.php
Remove Links to WooCommerce Single Product Page
// Remove Links to WooCommerce Single Product Page
remove_action( 'woocommerce_before_shop_loop_item', 'woocommerce_template_loop_product_link_open', 10 );
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_product_link_close', 5 );
@mehedicsit
mehedicsit / css-selectors.md
Created November 14, 2017 05:12 — forked from magicznyleszek/css-selectors.md
CSS Selectors Cheatsheet

CSS Selectors Cheatsheet

Element selectors

Element -- selects all h2 elements on the page

h2 {
    foo: bar;
@mehedicsit
mehedicsit / media-query.css
Created December 8, 2017 05:32 — forked from gokulkrishh/media-query.css
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS
@mehedicsit
mehedicsit / migrateorders.php
Created January 25, 2018 02:24 — forked from cfaria/migrateorders.php
Migrate WooCommerce Orders
<?php
//increase max execution time of this script to 150 min:
ini_set('max_execution_time', 9000);
//increase Allowed Memory Size of this script:
ini_set('memory_limit','960M');
// Copies woocommerce orders and users over from source to target.
// I use this on my local machine - loading both db's up there side by side
// could easily adjust the connect strings to connect elsewhere if needed.
@mehedicsit
mehedicsit / functions.php
Created March 21, 2018 14:05 — forked from mikejolley/functions.php
WooCommerce - Disable ALL sale prices with code
<?php
/**
* After adding this code to theme functions.php, ensure you clear transients via WC > System Status > Tools
*/
add_filter( 'woocommerce_get_sale_price', '__return_empty_string' );
add_filter( 'woocommerce_variation_prices_sale_price', '__return_empty_string' );
add_filter( 'woocommerce_variation_prices_price', 'custom_get_price', 10, 2 );
add_filter( 'woocommerce_get_price', 'custom_get_price', 10, 2 );
@mehedicsit
mehedicsit / select-text-woo-checkoutt.php
Created May 22, 2018 18:00 — forked from mchrislay/select-text-woo-checkoutt.php
Add Select Radio Buttons + Text Field option to WooCommerce Checkout Page
<?php
/**
* Outputs a rasio button form field
*/
function woocommerce_form_field_radio( $key, $args, $value = '' ) {
global $woocommerce;
$defaults = array(
'type' => 'radio',
'label' => '',