Skip to content

Instantly share code, notes, and snippets.

@brunoalvarenga
brunoalvarenga / custom-my-account-endpoint.php
Created October 7, 2016 13:22 — forked from claudiosanches/custom-my-account-endpoint.php
Example of custom My Account endpoint.
<?php
class My_Custom_My_Account_Endpoint {
/**
* Custom endpoint name.
*
* @var string
*/
public static $endpoint = 'my-custom-endpoint';
// Difference for between now and a date in the future
$future_timestamp = strtotime( '1st January 2020' );
$difference = human_time_diff( current_time( 'timestamp' ), $future_timestamp );
// Difference between a date in the past and now
$past_timestamp = strtotime( '1st January 2016' );
$difference = human_time_diff( $past_timestamp, current_time( 'timestamp' ) );
// Get The Page ID You Need
get_option( 'woocommerce_shop_page_id' );
get_option( 'woocommerce_cart_page_id' );
get_option( 'woocommerce_checkout_page_id' );
get_option( 'woocommerce_pay_page_id' );
get_option( 'woocommerce_thanks_page_id' );
get_option( 'woocommerce_myaccount_page_id' );
get_option( 'woocommerce_edit_address_page_id' );
get_option( 'woocommerce_view_order_page_id' );
get_option( 'woocommerce_terms_page_id' );
/* global shipping for each seller into the seller profile */
add_action( 'show_user_profile', 'my_show_extra_profile_fields' );
add_action( 'edit_user_profile', 'my_show_extra_profile_fields' );
function my_show_extra_profile_fields( $user ) {
$country_obj = new WC_Countries();
$countries = $country_obj->countries;
$states = $country_obj->states;
@brunoalvarenga
brunoalvarenga / load_settings_menu.php
Created October 4, 2016 22:57 — forked from sabbir1991/load_settings_menu.php
Add extra menu in Settings menu in Dokan Dashboard
/** Adding Settings extra menu in Settings tabs Dahsboard */
add_filter( 'dokan_get_dashboard_settings_nav', 'dokan_add_settings_menu' );
function dokan_add_settings_menu( $settings_tab ) {
$settings_tab['nayem'] = array(
'title' => __( 'Nayem', 'dokan'),
'icon' => '<i class="fa fa-user"></i>',
'url' => dokan_get_navigation_url( 'settings/nayem' ),
'pos' => 32
@brunoalvarenga
brunoalvarenga / remove_wc_password_meter.php
Created October 4, 2016 21:44 — forked from mahbubme/remove_wc_password_meter.php
Remove WordPress default password strength meter
<?php
function remove_wc_password_meter() {
wp_dequeue_script( 'wc-password-strength-meter' );
}
add_action( 'wp_print_scripts', 'remove_wc_password_meter', 100 );
@brunoalvarenga
brunoalvarenga / dokan-dashboard-responsive.js
Created October 4, 2016 21:44 — forked from mahbubme/dokan-dashboard-responsive.js
It will help you to solve the Dokan plugin dashboard related tables responsive issue.
jQuery(function($) {
$(".dokan-dashboard-content .dokan-table").addClass("table");
$( ".dokan-dashboard-content .dokan-table" ).before( "<div class='table-responsive'></div>" );
$( ".dokan-dashboard-content .table-responsive" ).append( $( ".dokan-table" ) );
});
@brunoalvarenga
brunoalvarenga / dokan-translation-file-name.txt
Created October 4, 2016 21:43 — forked from mahbubme/dokan-translation-file-name.txt
Dokan plugin and add-ons translation files name ( File Location: wp-content->languages->plugins )
1) Dokan Plugin
dokan-fr_FR.po
dokan-fr_FR.mo
2) Dokan Live Search
dokan_ls-fr_FR.mo
dokan_ls-fr_FR.po
3) Dokan Paypal Adaptive
dokan-wc-pap-fr_FR.po
@brunoalvarenga
brunoalvarenga / loading.js
Created October 4, 2016 21:43 — forked from mahbubme/loading.js
Simple preloader jQuery script and CSS for web page layout.
$(document).ready(function() {
// Preloading
var div_box = "<div id='load-screen'><div id='loading'></div></div>";
$("body").prepend(div_box);
$('#load-screen').delay(700).fadeOut(600, function(){
$(this).remove();
});
@brunoalvarenga
brunoalvarenga / dokan-new-shipping-processing-time.php
Created October 4, 2016 21:43 — forked from mahbubme/dokan-new-shipping-processing-time.php
Increase shipping processing time from seller dashboard for Dokan plugin
<?php
function dokan_new_shipping_processing_times() {
$times = array(
'' => __( 'Ready to ship in...', 'dokan' ),
'1' => __( '1 business day', 'dokan' ),
'2' => __( '1-2 business day', 'dokan' ),
'3' => __( '1-3 business day', 'dokan' ),
'4' => __( '3-5 business day', 'dokan' ),
'5' => __( '1-2 weeks', 'dokan' ),