Skip to content

Instantly share code, notes, and snippets.

View nayemDevs's full-sized avatar

Md. Nazmul Hassan nayemDevs

View GitHub Profile
@nayemDevs
nayemDevs / delete.php
Created January 4, 2023 04:29 — forked from alamgircsebd/delete.php
Scripts for Delete WooCommerce Products by User ID
<?php
$userID = 2;
$args = array( 'author' => $userID, 'post_type' => 'product', 'posts_per_page' => -1, 'post_status' => array( 'publish', 'pending', 'draft', 'future' ) );
$the_query = new WP_Query( $args );
// The Loop
if ( $the_query->have_posts() ) {
while ( $the_query->have_posts() ) {
$the_query->the_post();
wp_delete_post( get_the_ID(), true );
@nayemDevs
nayemDevs / functions.php
Last active March 7, 2021 09:58 — forked from sabbir1991/functions.php
Render and manage all SEO fields in admin user edit profile
<?php
add_action( 'dokan_seller_meta_fields', 'dokan_load_store_seo_field_in_admin', 10 );
add_action( 'dokan_process_seller_meta_fields', 'dokan_process_seller_seo_data', 10 );
function dokan_load_store_seo_field_in_admin( $user ) {
$seo = new Dokan_Pro_Store_Seo();
$seller_profile = dokan_get_store_info( $user->ID );
$seo_meta = isset( $seller_profile['store_seo'] ) ? $seller_profile['store_seo'] : array();
@nayemDevs
nayemDevs / functions.php
Created October 14, 2016 16:35 — forked from sabbir1991/functions.php
Added shop url into wp admin new user interface
// Add this actions
add_action( 'user_new_form', 'add_seller_store_field', 10 );
add_action( 'edit_user_created_user', 'add_shop_url_for_seller' , 10, 2);
// Add this filter
add_filter( 'user_profile_update_errors', 'check_fields_add_new_user', 10, 3 );
function add_shop_url_for_seller( $user_id, $notify ) {
if ( ! $user_id ) {
return;
}
// 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 / 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 / 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