Skip to content

Instantly share code, notes, and snippets.

View mahbubme's full-sized avatar
🤞
Focusing

Mahbubur Rahman mahbubme

🤞
Focusing
View GitHub Profile
<?php
/*
* Paste this code in the functions.php
*/
add_action( 'woocommerce_after_add_to_cart_button', 'seller_link_in_product_page');
function seller_link_in_product_page() {
@mahbubme
mahbubme / update_sehedule_product_date_meta.php
Created January 11, 2017 09:17
Update date meta for WooCommerce schedule product with WPUF fields
function update_product_schedule_date_meta( $post_id ) {
$dates_from = get_post_meta( $post_id, '_sale_price_dates_from', true );
$dates_to = get_post_meta( $post_id, '_sale_price_dates_to', true );
$dates_from = strtotime($dates_from);
$dates_to = strtotime($dates_to);
update_post_meta( $post_id, '_sale_price_dates_from', $dates_from );
update_post_meta( $post_id, '_sale_price_dates_to', $dates_to );
}
@mahbubme
mahbubme / functions.php
Created September 27, 2017 09:09
Fix Facebook Feed WD plugin conflicting issue with WP User Frontend plugin.
if ( function_exists('ffwd_activate') ) {
remove_filter( 'mce_external_plugins', 'ffwd_register' );
remove_filter( 'mce_buttons', 'ffwd_add_button', 0 );
if ( is_admin() ) {
add_filter( 'mce_external_plugins', 'ffwd_register' );
add_filter( 'mce_buttons', 'ffwd_add_button', 0 );
}
}
@mahbubme
mahbubme / add-new-git-remote
Last active September 29, 2017 11:06
Automated GIT Deployment
root@serveraddress:DirectoryURL/.git
function Stack() {
this.value = [];
}
Stack.prototype.push = function(value) {
return this.value.push(value);
}
Stack.prototype.pop = function() {
return this.value.pop() ? true : false;
@mahbubme
mahbubme / billing-address.php
Created November 19, 2017 06:26
Override billing adddress template
<?php
global $current_user;
$address_fields = array();
if ( isset( $_POST['add_line_1'] )
&& isset( $_POST['city'] )
&& isset( $_POST['state'] )
&& isset( $_POST['zip_code'] )
@mahbubme
mahbubme / billing-address.php
Created November 19, 2017 06:26
Override billing adddress template
<?php
global $current_user;
$address_fields = array();
if ( isset( $_POST['add_line_1'] )
&& isset( $_POST['city'] )
&& isset( $_POST['state'] )
&& isset( $_POST['zip_code'] )
@mahbubme
mahbubme / wp_mail.md
Created January 25, 2018 14:29 — forked from johnbillion/wp_mail.md
WordPress Emails

WordPress Emails

This document lists all the situations where WordPress sends an email, along with how to filter or disable each email.

This is accurate as of WordPress 4.9.

There are a few TODOs left. Please bear with me.

<?php
function wpuf_unique_product_sku_notice( $error ) {
if ( isset( $_POST['_sku'] ) ) {
global $wpdb;
$sku = $_POST['_sku'];
$product_id = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key='_sku' AND meta_value='%s' LIMIT 1", $sku ) );
@mahbubme
mahbubme / functions.php
Created July 31, 2018 08:37
Add user role name to body tag as class
<?php
// Add user role as body class
function print_user_classes() {
add_filter('body_class','class_to_body');
}
add_action('init', 'print_user_classes');
// Add user role class to front-end body tag
function class_to_body($classes) {