Skip to content

Instantly share code, notes, and snippets.

View vodanh1213's full-sized avatar

Hoang Ngo vodanh1213

View GitHub Profile
<?php
/*
* Plugin Name: Marketpress csv converter
Author: Hoang
Version: 1.0
*/
add_action('admin_menu', 'mpc_admin_menu');
function mpc_admin_menu()
{
function _mp_cart_shipping($editable = false, $echo = false)
{
global $mp, $current_user;
$meta = wp_parse_args(get_user_meta($current_user->ID, 'mp_shipping_info', true), array(
'address1' => '',
'address2' => '',
'city' => '',
'state' => '',
'zip' => '',
add_action('wdf_after_goal_complete', 'fundraiser_done_send_email');
function fundraiser_done_send_email($pledges)
{
$small_amount_emails = array();
$large_amount_emails = array();
foreach ($pledges as $pledge) {
$data = get_post_meta($pledge->ID, 'wdf_transaction', true);
if ($data['gross'] < 5) {
$small_amount_emails[] = $data['payer_email'];
} else {
@vodanh1213
vodanh1213 / gist:6d2682cb76057905ae83
Last active October 22, 2015 22:23
Job location field
<?php
/*
Plugin Name: Jobs & Experts Job location field
Author: Hoang Ngo
Version: 1.0
*/
add_filter('je_job_additions_field', 'job_add_location_field');
function job_add_location_field($fields)
@vodanh1213
vodanh1213 / gist:e533fe64dcf334ba4b28
Last active August 29, 2015 14:17
membership days remaining
add_shortcode('m_count_down', 'm_count_down');
function m_count_down($attr)
{
if (class_exists('Membership_Plugin')) {
$subscription_id = isset($attr['s_id']) ? $attr['s_id'] : 0;
if (!is_user_logged_in()) {
return '';
}
if ($subscription_id == 0) {
<?php
/*
Plugin Name: Membership Users Exporter
Author: Hoang Ngo
Version: 1.0
*/
add_action('admin_menu', 'me_main_menu');
add_action('wp_loaded', 'me_export_users');
function me_main_menu()
{
add_shortcode('list_domains_wpmu', 'list_domains_wpmu');
function list_domains_wpmu($attrs = array())
{
$default = array(
'root_domain' => parse_url(get_site_url(1), PHP_URL_HOST)
);
$a = wp_parse_args($attrs, $default);
$domains = get_site_option('md_domains');
$data = array();
foreach ($domains as $domain) {
!function(){function t(t){"closed"===r?t._show()?(s=t,r="open"):e(t):u[u.length]=t}function e(){if(r="closed",s=null,u.length>0){var e=u.shift();t(e)}}function o(t,e,o){var n,p,d=0,r=i(window.location.toString()),u=i(document.referrer.toString()),s=null,c=function(e){s=jQuery.extend({},t),s.popup=e,a(s)};return void 0!==window.force_popover&&(d=window.force_popover.toString()),void 0!==e&&(d=e.toString()),t.ajax_data=t.ajax_data||{},p=jQuery.extend({},t.ajax_data),p.action="inc_popup",p["do"]=t["do"],p.thefrom=r,p.thereferrer=u,d&&(p.po_id=d),o&&(p.data=o),t.preview&&(p.preview=!0),n={url:t.ajaxurl,dataType:"jsonp",jsonpCallback:"po_data",data:p,success:function(t){c(t)},complete:function(){jQuery(document).trigger("popup-load-done",[s])}},jQuery.ajax(n)}function a(t){if(void 0!==t){var e=function(t){void 0!==t&&(void 0!==t.popup&&void 0!==t.popup.html&&(jQuery('<style type="text/css">'+t.popup.styles+"</style>").appendTo("head"),jQuery(t.popup.html).appendTo("body").hide()),window.inc_popup=new d(t),window.i
@vodanh1213
vodanh1213 / gist:f82ffc82e2cf6c4fd400
Created July 2, 2015 15:37
Recent post global shortcode
add_shortcode( 'global_recent_posts', 'global_recent_posts_sc' );
function global_recent_posts_sc( $atts ) {
$atts = wp_parse_args( $atts, array(
'order' => 'ASC',
'orderby' => 'post_title',
'is_meta' => 0,
'post_type' => 'post',
'post_status' => 'publish',
'recentglobalpostsdisplay' => 'title_content',
'recentglobalpostsnumber' => '5',
@vodanh1213
vodanh1213 / gist:26f55104b17ab6bf699c
Created July 2, 2015 15:49
Recent post global shortcode
add_shortcode( 'global_recent_posts', 'global_recent_posts_sc' );
function global_recent_posts_sc( $atts ) {
$data = wp_parse_args( $atts, array(
'order' => '',
'orderby' => '',
'is_meta' => 0,
'post_type' => 'post',
'post_status' => 'publish',
'recentglobalpostsdisplay' => 'title_content',
'recentglobalpostsnumber' => '5',