Skip to content

Instantly share code, notes, and snippets.

View mayeenulislam's full-sized avatar
🤖
AI won't replace you

Mayeenul Islam mayeenulislam

🤖
AI won't replace you
View GitHub Profile
@mayeenulislam
mayeenulislam / english_to_bangla.js
Last active February 24, 2022 10:55 — forked from sharif2008/english_to_bangla.js
Converting English number to Bangla in Javascript
var finalEnlishToBanglaNumber={'0':'০','1':'১','2':'২','3':'৩','4':'৪','5':'৫','6':'৬','7':'৭','8':'৮','9':'৯'};
String.prototype.getDigitBanglaFromEnglish = function() {
var retStr = this;
for (var x in finalEnlishToBanglaNumber) {
retStr = retStr.replace(new RegExp(x, 'g'), finalEnlishToBanglaNumber[x]);
}
return retStr;
};
@mayeenulislam
mayeenulislam / install-wp-plugins.php
Created January 24, 2020 04:16 — forked from squarestar/install-wp-plugins.php
Programmatically install and activate wordpress plugins
<?php
/**
* Programmatically install and activate wordpress plugins
*
* Usage:
* 1. Edit the $pluginSlugs array at the beginning of this file to include the slugs of all the
* plugins you want to install and activate
* 2. Upload this file to the wordpress root directory (the same directory that contains the
* 'wp-admin' directory).
* 3. Navigate to <your-domain-wordpress-root>/install-wp-plugins.php (If wordpress is installed
@mayeenulislam
mayeenulislam / data.json
Last active July 10, 2019 17:08 — forked from hasinhayder/data.json
WP Quick Configurator Data
{
"themes": [],
"plugins": [
"elementor",
"happy-elementor-addons",
"contact-form-7",
"query-monitor",
"regenerate-thumbnails",
"debug-bar",
"debug-bar-console",
@mayeenulislam
mayeenulislam / functions.php
Created March 30, 2018 05:25 — forked from lmartins/functions.php
By default WooCommerce redirects the user to the My Account page after a successful login. You may change this and use a custom URL based on the user role, like the Dashboard for admins and My Account page for customers. To do this, add this code at the end of the file functions.php located in wp-content/themes/your-theme-name/ https://support.w…
<?php
/**
* Redirect users to custom URL based on their role after login
*
* @param string $redirect
* @param object $user
* @return string
*/
function wc_custom_user_redirect( $redirect, $user ) {
// Get the first of all the roles assigned to the user
<?php
add_action( 'pre-upload-ui', 'get_the_post_type' );
function get_the_post_type() {
$post_type = isset( $_REQUEST['post_type'] ) ? $_REQUEST['post_type'] : 'post';
set_transient( 'attached_post_type', $post_type );
}
add_filter( 'intermediate_image_sizes_advanced', 'add_image_size_for_post_type', 10 );
function add_image_size_for_post_type( $sizes ) {
@mayeenulislam
mayeenulislam / wpmail_exceptions.php
Last active November 2, 2017 05:35 — forked from franz-josef-kaiser/wpmail_exceptions.php
WP Mail Error/Exception handling and SMTP settings. ALWAYS use the Kaiser's version - it's safer. This forked version is just to catch errors in the case of non-admin users.
<?php
/**
* NOTICE_____________________________________________________________________
* ALWAYS use the Kaiser's version - it's safer.
* This forked version is just to catch errors in the case of non-admin users.
* ---------------------------------------------------------------------------
*/
defined( 'ABSPATH' ) OR exit;
/**
@mayeenulislam
mayeenulislam / how-to-secure-your-site-with-https.md
Created May 26, 2017 12:40 — forked from nepsilon/how-to-secure-your-site-with-https.md
How to secure your site with HTTPS? — First published in fullweb.io issue #101

How to secure your site with HTTPS?

With HTTP everything is visible when traveling on the Internet. By generating an SSL certificate and configuring your webserver you can force browsers to use HTTPS. Here is how to proceed:

# 1. Install letsencrypt
sudo pip install letsencrypt
@mayeenulislam
mayeenulislam / gist:a52b78395f9907f466e8dac2d29a60ec
Created March 24, 2017 18:46 — forked from toddlahman/gist:6302280
Save Plugin Error Messages in the database for The Plugin Generated x Characters of Unexpected Output During Activation errors
<?php
function tl_save_error() {
update_option( 'plugin_error', ob_get_contents() );
}
add_action( 'activated_plugin', 'tl_save_error' );
/* Then to display the error message: */
@mayeenulislam
mayeenulislam / how-to-disable-html-links-with-css.md
Created March 21, 2017 03:42 — forked from nepsilon/how-to-disable-html-links-with-css.md
How to disable HTML links with CSS? — First published in fullweb.io issue #92
@mayeenulislam
mayeenulislam / functions.php
Created February 7, 2017 06:38 — forked from EmranAhmed/functions.php
Hook Info. Get Action hook info. What functions are hooked to an action / filter in WordPress? How can I see all the actions attached to an "add_action" hook?
<?php
if ( ! function_exists( 'hippo_plugin_hook_info' ) ):
function hippo_plugin_hook_info( $hook_name ) {
global $wp_filter;
$docs = array();
$template = "\t - %s Priority - %s.\n\tin file %s #%s\n\n";
echo '<pre>';