Skip to content

Instantly share code, notes, and snippets.

View nayemDevs's full-sized avatar

Md. Nazmul Hassan nayemDevs

View GitHub Profile
function wpufe_update_post_geo1( $post_id ) {
function gmw_update_post_type_post_location( $post_id ) {
// Return if it's a post revision
if ( false !== wp_is_post_revision( $post_id ) )
return;
// check autosave //
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
@nayemDevs
nayemDevs / thumbnail of store listing page
Created July 21, 2016 02:01
Image thumbnail on store-list page
<?php
// Change store thumb size in store listing page
add_filter( 'dokan_store_list_args', 'change_store_list_thumb_size' );
function change_store_list_thumb_size( $args ) {
$args['image_size'] = 'full';
return $args;
add_filter( 'dokan_store_list_args', 'change_store_list_thumb_size' );
function change_store_list_thumb_size( $args ) {
$args['image_size'] = 'full';
return $args;
}
@nayemDevs
nayemDevs / Redirect seller after registration : Dokan
Created June 22, 2016 09:21
You can replace the location "settings/store" to your own location like as dokan_get_navigation_url( 'dashboard' );
add_filter('woocommerce_registration_redirect', 'ps_wc_registration_redirect');
function ps_wc_registration_redirect( $redirect_to ) {
if ( is_user_logged_in() ){
$current_user = wp_get_current_user();
if( $current_user->roles[0] == 'seller' ) {
$redirect_to = dokan_get_navigation_url( 'settings/store' );
return $redirect_to;
}
}
return $redirect_to;
function remove_wc_password_meter() {
wp_dequeue_script( 'wc-password-strength-meter' );
}
add_action( 'wp_print_scripts', 'remove_wc_password_meter', 100 );
@nayemDevs
nayemDevs / set default category for a form
Created June 6, 2016 05:44
Now, after adding these code you have to add a hidden field into your form. You have to insert the meta key name "wpuf_hidden_cat" and the value will be your category ID.
add_action( 'wpuf_add_post_after_insert', function( $post_id ) {
wp_set_post_terms( $post_id, get_post_meta( $post_id, 'wpuf_hidden_cat', true ), 'your taxonomies name' );
});
// First Register the Tab by hooking into the 'woocommerce_product_data_tabs' filter
add_filter( 'woocommerce_product_data_tabs', 'add_my_custom_product_data_tab' );
function add_my_custom_product_data_tab( $product_data_tabs ) {
$product_data_tabs['my-custom-tab'] = array(
'label' => __( 'My Custom Tab', 'my_text_domain' ),
'target' => 'my_custom_product_data',
);
return $product_data_tabs;
}
add_filter('woocommerce_registration_redirect', 'ps_wc_registration_redirect');
function ps_wc_registration_redirect( $redirect_to ) {
if ( is_user_logged_in() ){
$current_user = wp_get_current_user();
if( $current_user->roles[0] == 'seller' ) {
$redirect_to = dokan_get_navigation_url( 'dashboard' );
return $redirect_to;
}
}
return $redirect_to;
/* 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;
/*
Show Seller name on the product thumbnail
For Dokan Multivendor plugin
*/
add_action( 'woocommerce_after_shop_loop_item_title','sold_by' );
function sold_by(){
?>
</a>
<?php