Skip to content

Instantly share code, notes, and snippets.

View nayemDevs's full-sized avatar

Md. Nazmul Hassan nayemDevs

View GitHub Profile
@nayemDevs
nayemDevs / load_settings_menu.php
Last active October 14, 2021 17:40 — 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
@nayemDevs
nayemDevs / wpuf-woo-price.php
Created January 6, 2016 13:23 — forked from tareq1988/wpuf-woo-price.php
WooCommerce price adjustment for WPUF
<?php
/**
* WooCommerce price adjustment for WPUF
*
* @param int $post_id
*
* @return void
*/
function wpufe_update_post_price( $post_id ) {
@nayemDevs
nayemDevs / before-login-message
Created April 2, 2016 06:38
show your message on the login page
add_action( 'woocommerce_before_customer_login_form', 'before_login_message' );
function before_login_message() {
if ( get_option( 'woocommerce_enable_myaccount_registration' ) == 'yes' ) {
?>
<div class="woocommerce-info">
<p><?php _e( 'Returning customers login. New users register for next time so you can:' ); ?></p>
<ul>
<li><?php _e( 'View your order history' ); ?></li>
<li><?php _e( 'Check on your orders' ); ?></li>
<li><?php _e( 'Edit your addresses' ); ?></li>
@nayemDevs
nayemDevs / extra-field.php
Last active September 19, 2023 16:10
Add extra field on vendor settings area and show the field value on the store banner
/*Extra field on the seller settings and show the value on the store banner -Dokan*/
// Add extra field in seller settings
add_filter( 'dokan_settings_form_bottom', 'extra_fields', 10, 2);
function extra_fields( $current_user, $profile_info ){
$seller_url= isset( $profile_info['seller_url'] ) ? $profile_info['seller_url'] : '';
?>
<div class="gregcustom dokan-form-group">
/*
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
/* 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;
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;
// 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;
}
@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' );
});
function remove_wc_password_meter() {
wp_dequeue_script( 'wc-password-strength-meter' );
}
add_action( 'wp_print_scripts', 'remove_wc_password_meter', 100 );