Skip to content

Instantly share code, notes, and snippets.

View sabbir1991's full-sized avatar
🏠
Working from home

Sabbir Ahmed sabbir1991

🏠
Working from home
View GitHub Profile
@sabbir1991
sabbir1991 / add_dashboard_menu.php
Last active December 11, 2022 08:33
Adding a Main Dashboard Menu in Dokan Dashboard
<?php
add_filter( 'dokan_query_var_filter', 'dokan_load_sabbir_menu' );
function dokan_load_sabbir_menu( $query_vars ) {
$query_vars['sabbir'] = 'sabbir';
return $query_vars;
}
add_filter( 'dokan_get_dashboard_nav', 'dokan_add_sabbir_menu' );
@sabbir1991
sabbir1991 / load_settings_menu.php
Last active November 29, 2017 11:29
Add extra menu in Settings menu in Dokan Dashboard
<?php
/** 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>',
@sabbir1991
sabbir1991 / plugins.php
Last active February 27, 2017 07:04
Add DB Table from wp plugin
<?php
register_activation_hook( __FILE__, 'plugin_activate' );
function plugin_activate() {
global $wpdb;
$table_name = $wpdb->prefix . 'wpems_class';
$sql = "CREATE TABLE IF NOT EXISTS {$table_name} (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`class_name` varchar(255) DEFAULT NULL,
@sabbir1991
sabbir1991 / functions.php
Last active November 21, 2017 13:26
Added extra widget in dokan store page with store extra information
<?php
/* Booth news field seller settings */
add_filter( 'dokan_settings_form_bottom', 'extra_fields', 10, 2);
function extra_fields( $current_user, $profile_info ){
$booth_news= get_user_meta( $current_user, 'booth_news', true );
$about_us= get_user_meta( $current_user, 'about_us', true );
?>
<div class="gregcustom dokan-form-group">
@sabbir1991
sabbir1991 / functions.php
Last active February 27, 2017 07:03
Add extra shortcodes in sms body
<?php
//Add new shortcodes
add_filter( 'sat_sms_get_order_shortcodes', function( $codes ) {
$codes[] = '[order_pdf_voucher]';
return $codes;
} );
// For displaying your shortcoders in backend settings
add_filter( 'sat_sms_shortcode_insert_description', function( $content ) {
@sabbir1991
sabbir1991 / functions.php
Last active February 6, 2019 20:57
Added shop url into wp admin new user interface
<?php
// 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;
@sabbir1991
sabbir1991 / functions.php
Created January 20, 2017 06:31
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();
@sabbir1991
sabbir1991 / pr.md
Created May 18, 2017 07:13 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@sabbir1991
sabbir1991 / functions.php
Last active November 23, 2017 18:50
File Upload in WordPress in custom directory
<?php
function wp1982_handle_file_upload( $filename, $file_url ) {
add_filter( 'upload_dir', 'wp1982_customize_upload_dir', 10 );
$upload_file = wp_upload_bits( $filename, null, file_get_contents( $file_url ) );
remove_filter( 'upload_dir', 'wp1982_customize_upload_dir' , 10 );
if ( !$upload_file['error'] ) {
$wp_filetype = wp_check_filetype( $filename, null );
$attachment = array(
@sabbir1991
sabbir1991 / wpinstaller.sh
Created October 16, 2017 08:44
Autometic WP installation Process using bash
#!/bin/bash
clear
# Remove/Uninstall process
echo "Start WordPress installation"
if [[ $1 == "remove" ]]; then
# Grab the project name
if [[ -z $2 ]]; then
echo "WP Project to remove: "