Skip to content

Instantly share code, notes, and snippets.

View pije76's full-sized avatar

panjianom pije76

View GitHub Profile
@pije76
pije76 / functions.php
Created June 24, 2019 13:13 — forked from hlashbrooke/functions.php
WooCommerce Product Vendors: Add extra custom fields to vendor profiles
<?php
// Add fields to new vendor form
add_action( 'shop_vendor_add_form_fields', 'custom_add_vendor_fields', 2, 1 );
function custom_add_vendor_fields( $taxonomy ) {
?>
<div class="form-field">
<label for="vendor_website"><?php _e( 'Vendor website' ); ?></label>
<input type="text" name="vendor_data[website]" id="vendor_website" class="vendor_fields" /><br/>
<span class="description"><?php _e( 'The vendor\'s website.' ); ?></span>
@pije76
pije76 / example.php
Created June 23, 2019 08:05 — forked from dave-mills/example.php
Example Callback function for Ultimate Member dropdown field
function getCities() {
//get the value from the 'parent' field, sent via the AJAX post.
$choice = $_POST['parent_option'];
//Depending on the value of $choice, return a different array.
switch($choice) {
case "France":
$cities = [
"Paris" =>"Paris",
@pije76
pije76 / mycred-woo-coupon
Created June 22, 2019 13:28 — forked from gabrielmerovingi/mycred-woo-coupon
This custom shortcode allows your users to convert their myCRED points into a WooCommerce coupon, in order to give themselves a discount or partial payment on their order. In order for this to work, you need to set an exchange rate between points and your store currency and select. Requires myCRED 1.6+ and WooCommerce 2.4+
/**
* Convert myCRED Points into WooCommerce Coupon
* Requires myCRED 1.4 or higher!
* @version 1.3.1
*/
add_shortcode( 'mycred_to_woo_coupon', 'mycred_pro_render_points_to_coupon' );
function mycred_pro_render_points_to_coupon( $atts, $content = NULL ) {
// Users must be logged in
if ( ! is_user_logged_in() )
@pije76
pije76 / pmpromyCRED.php
Created June 20, 2019 16:32 — forked from strangerstudios/pmpromyCRED.php
Award MyCRED points for members who sign up for Membership Level 1.
<?php
/*
Use this recipe in combination with MyCRED to award points to members when signing up
for Level 1 membership. This code gist could be customized to give points for another
membership level ID, award recurring points for each subscription payment, and more.
MyCRED can be downloaded/configured here: https://wordpress.org/plugins/mycred/
*/
// Register Hook for PMPro Membership Points at Signup
@pije76
pije76 / um-profile-show-id.php
Last active June 20, 2019 07:17 — forked from cryptexvinci/um-profile-show-id.php
Ultimate member - Display User ID below Username in Profile Page. (*Cek Profile Programmmernya)
/**
* Ultimate member - Display User ID below Username in Profile Page.
* @link https://wordpress.org/plugins/ultimate-member/
*/
function custom_display_id_profile_page(){
echo '<p>';
esc_html_e( 'Membership ID: ', 'theme-name');
echo um_profile_id();
echo '</p>';
<?php
add_filter( 'wpseo_canonical', 'um_custom_user_yoast_canonical' );
function um_custom_user_yoast_canonical() {
if( function_exists('um_is_core_page') ){
if ( um_is_core_page('user') && um_get_requested_user() ) {
um_fetch_user( um_get_requested_user() );
/* add new tab called "mytab
/*Original author is Ultimate Member*/
add_filter('um_account_page_default_tabs_hook', 'my_custom_tab_in_um', 100 );
function my_custom_tab_in_um( $tabs ) {
$tabs[800]['mytab']['icon'] = 'um-faicon-pencil';
$tabs[800]['mytab']['title'] = 'My Custom Tab';
$tabs[800]['mytab']['custom'] = true;
return $tabs;
}
@pije76
pije76 / filter.php
Created June 16, 2019 12:33 — forked from plusplugins/filter.php
Adding a custom field to Ultimate Members directory search options
add_filter('um_admin_custom_search_filters','add_my_custom_search_fields', 10, 1);
function add_my_custom_search_fields($fields) {
$fields['field_meta_key'] = array('title' => 'Enter field title'); // replace 'field_meta_key' with your field meta key
return $fields;
}
@pije76
pije76 / Heroku Database.md
Created May 21, 2018 04:22 — forked from stevenyap/Heroku Database.md
Heroku for backup, exporting and importing database

Note: You need to have to Heroku PGBackup addon first heroku addons:add pgbackups..

Importing Heroku PG DB to local

Creates the backup on heroku first:

heroku pgbackups:capture
@pije76
pije76 / cot.cad.R
Created April 9, 2018 11:45 — forked from creative-quant/cot.cad.R
COT - CAD
############################################################
## Content of the Traders in Financial Futures (TFF) Report
## http://www.cftc.gov/ucm/groups/public/@commitmentsoftraders/documents/file/tfmexplanatorynotes.pdf
############################################################
# Dealer/Intermediary
# These participants are what are typically described as the "sell side” of the market. Though they
# may not predominately sell futures, they do design and sell various financial assets to clients.
# They tend to have matched books or offset their risk across markets and clients. Futures
# contracts are part of the pricing and balancing of risk associated with the products they sell and
# their activities. These include large banks (U.S. and non-U.S.) and dealers in securities, swaps