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
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}
@mayeenulislam
mayeenulislam / functions.php
Created February 16, 2016 06:59 — forked from hasinhayder/functions.php
Redirect WordPress posts to the editor if someone types /edit at the end of the permalink
<?php
function init_url_rewrite_rule(){
add_rewrite_endpoint( 'edit',EP_PERMALINK | EP_PAGES | EP_ATTACHMENT );
if(get_option("EDIT_REWRITE_RULE")!=1){
flush_rewrite_rules();
update_option("EDIT_REWRITE_RULE",1);
}
}
function redirect_edit_url(){
<?php
$data_dir = 'c:/server/www/dev/data/';
$releases = [ ];
foreach ( range( 3.2, 4.0, 0.1 ) as $version ) {
$version = number_format( $version, 1 );
$data = json_decode( file_get_contents( $data_dir . $version . '.json' ), true );
$groups = wp_list_pluck( $data['groups'], 'data' );
@mayeenulislam
mayeenulislam / index.html
Last active November 21, 2019 04:40 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!DOCTYPE html>
<title>Site Maintenance - {{sitename}}</title>
<style>
body { text-align: center; padding: 10%; }
h1 { font-size: 50px; margin-bottom: 0; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 90%; max-width: 700px; margin: 0 auto; }
a { color: #19a15e; text-decoration: none; font-weight: bold; }
a:hover { color: #333; text-decoration: none; }
</style>
@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>';
@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 / 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-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 / 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;
/**
<?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 ) {