Skip to content

Instantly share code, notes, and snippets.

View mehedicsit's full-sized avatar

Mehedi Hasan mehedicsit

View GitHub Profile
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. ([email protected])
@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 / gist:20dda44732bc662d9862caca9ead4817
Created January 15, 2018 16:36
Woocommerce stock option
/*Stock option customization*/
function add_custom_stock_type() {
?>
<script type="text/javascript">
jQuery(function(){
jQuery('._stock_status_field').not('.custom-stock-status').remove();
});
</script>
<?php
@mehedicsit
mehedicsit / gist:fdcb9a8d7f7bf3cdaea478486d861a14
Created January 24, 2018 05:57
woo-commerce conditional payment method
add_action('woocommerce_check_cart_items','condtiontal_checkoout_total');
function condtiontal_checkoout_total(){
if ( WC()->cart->total > 10000 ) {?>
<style>
li.wc_payment_method.payment_method_stripe {
display: none;
}
</style>
<?php }
@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 / gist:6704c44b6af28417d7db01f8d0c269d7
Created January 28, 2018 18:39
How to add same product to cart twice instead of changing quantity in WooCommerce
function namespace_force_individual_cart_items( $cart_item_data, $product_id ) {
$unique_cart_item_key = md5( microtime() . rand() );
$cart_item_data['unique_key'] = $unique_cart_item_key;
return $cart_item_data;
}
add_filter( 'woocommerce_add_cart_item_data', 'namespace_force_individual_cart_items', 10, 2 );