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 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 / 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 / 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
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/');
@Kaiderella
Kaiderella / wp-config.php
Created March 30, 2017 02:43
Lỗi download failed
* @package WordPress
*/
define('WP_TEMP_DIR', ABSPATH . 'wp-content/');
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'anotherd_wrd1');
@Kaiderella
Kaiderella / wp-config.php
Created March 30, 2017 02:42
Lỗi download failed trong WordPress
* @package WordPress
*/
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'anotherd_wrd1');
@Kaiderella
Kaiderella / wp-config.php
Created March 27, 2017 04:42
Lỗi yêu cầu FTP
/*** FTP login settings ***/
define("FTP_HOST", "localhost");
define("FTP_USER", "ftp-user");
define("FTP_PASS", "ftp-password");
@Kaiderella
Kaiderella / wp-config.php
Created March 27, 2017 04:41
Lỗi yêu cầu FTP trong WordPress
define('FS_METHOD', 'direct');
@Kaiderella
Kaiderella / .htaccess
Created March 27, 2017 03:35
Thay đổi max_input_time với .htaccess
php_value max_input_time 120