This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Runs on User Registration | |
add_action( 'user_register', 'wc_map_guest_initial_match_past_orders', 10, 1 ); | |
function wc_map_guestinitial_match_past_orders( $user_id ) { | |
//Get current users's e-mail from ID | |
$current_user = get_user_by( 'ID', $user_id ); | |
$email = $current_user->user_email; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Pre-populate Woocommerce checkout fields | |
*/ | |
add_filter('woocommerce_checkout_get_value', function($input, $field ) { | |
global $current_user; | |
switch ($field) : | |
case 'billing_first_name': | |
case 'shipping_first_name': | |
return $current_user->first_name; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.woocommerce mark { | |
display: none; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'manage_shop_order_posts_columns', 'show_purchased_by_shop_order_columns' , 100 ); | |
add_action( 'manage_shop_order_posts_custom_column', 'show_purchased_by_render_shop_order_columns', 2 ); | |
add_filter( 'manage_edit-shop_order_sortable_columns', 'show_purchased_by_shop_order_sortable_columns' ); | |
/** | |
* Define custom columns for orders. | |
* @param array $columns | |
* @return array |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
---List of all gists at a glance--- | |
1)Display WooCommerce Recently viewed products Without a Shortcode. | |
2)Display WooCommerce Latest Products Without a Shortcode. | |
3)Add custom columns to the user table of the admin dashbord. | |
4)front-end to cpt including image(advance).Used in sharespace. | |
5)short code to get the woocommerce recently viewed products. | |
6)Show woocommerce featured product in home page. | |
7)Get the image,title and link of the parent term of product_cat taxonomy in woocommerce for creating the slide in home page with parent category. | |
8)Woocommerce product-details page common customization. | |
9)Display an Image Spinner During an Ajax Request. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ( ! defined( 'ABSPATH' ) ) { | |
exit; | |
} | |
?> | |
<div class="woocommerce-order"> | |
<?php if ( $order ) : ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
here's the code to populate a mailchimp field with a wordpress variable: | |
add_filter( 'mailchimp_sync_subscriber_data', function( MC4WP_MailChimp_Subscriber $subscriber, $user ) { | |
$subscriber->merge_fields['MERGE6'] = AFF_ID_GOES_HERE; | |
return $subscriber; | |
}, 10, 2 ); | |
here's the code to get the aff id: | |
if ( $affiliate = affiliate_wp()->affiliates->get_by( 'user_id', $user->ID ) ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.admin-bar p.demo_store { | |
top: 28px; | |
} | |
p.demo_store { | |
position: fixed; | |
top: 0; | |
left: 0; | |
right: 0; | |
margin: 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Povuci sve lokacije najblize lat i lon koji su prosledjeni | |
function get_posts_by_geo_distance($post_type,$lat_key,$lng_key,$source_lat,$source_lng) { | |
global $wpdb; | |
$sql =<<<SQL | |
SELECT | |
rl.ID, | |
rl.post_title AS location, | |
ROUND(6371*2*ASIN(SQRT(POWER(SIN(({$source_lat}-abs(lat.lat))*pi()/180/2),2)+ | |
COS({$source_lat}*pi()/180)*COS(abs(lat.lat)*pi()/180)* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: wordpress assist clean header | |
Plugin URI: http://www.wordpressassist.nl/ | |
Description: Remove shortlink hook | |
Version: 1.0 | |
Author: AukeJomm | |
Author URI: http://www.aukejongbloed.nl | |
*/ | |