This Gist was automatically created by Carbide, a free online programming environment.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Source: https://gist.github.com/luetkemj/2023628 | |
// Xem hướng dẫn WP_Query toàn tập: http://goo.gl/kRpzTz | |
<?php | |
$args = array( | |
//////Author Parameters - Tham số lấy bài viết theo tác giả | |
//http://codex.wordpress.org/Class_Reference/WP_Query#Author_Parameters | |
'author' => '1,2,3,', //(int) - Các ID tác giả cần lấy bài viết (thêm dấu - vào để loại trừ tác giả, ví dụ: -14, -20) | |
'author_name' => 'luetkemj', //(string) - Lấy bài viết dựa theo tên nick name của tác giả | |
'author__in' => array( 2, 6 ), //(array) - Lấy bài dựa theo ID của tác giả |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="group"> | |
<div class="box1"></div> | |
<div class="box2"></div> | |
<div class="box3"></div> | |
<div class="box4"></div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sgr_filter_image_sizes( $sizes) { | |
unset( $sizes['thumbnail']); | |
unset( $sizes['medium']); | |
unset( $sizes['large']); | |
return $sizes; | |
} | |
add_filter('intermediate_image_sizes_advanced', 'sgr_filter_image_sizes'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Custom the comment_form | |
function custom_comment_form() { | |
$commenter = wp_get_current_commenter(); | |
$req = get_option( 'require_name_email' ); | |
$aria_req = ( $req ? " aria-required='true'" : '' ); | |
$fields = array( | |
'author' => '<p class="comment-form-author">' . '<label for="author">' . __( 'Name','thachpham' ) . '</label> ' . ( $req ? '' : '' ) . | |
'<input id="author" placeholder="'.__('Enter your name','thachpham').'" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' /></p>', | |
'email' => '<p class="comment-form-email"><label for="email">' . __( 'Email' ) . '</label> ' . ( $req ? '' : '' ) . | |
'<input id="email" placeholder="'.__('Enter your email','thachpham').'" name="email" type="text" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' /></p>', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function the_excerpt_max_charlength($charlength) { | |
$excerpt = get_the_excerpt(); | |
$charlength++; | |
if ( mb_strlen( $excerpt ) > $charlength ) { | |
$subex = mb_substr( $excerpt, 0, $charlength - 5 ); | |
$exwords = explode( ' ', $subex ); | |
$excut = - ( mb_strlen( $exwords[ count( $exwords ) - 1 ] ) ); | |
if ( $excut < 0 ) { | |
echo mb_substr( $subex, 0, $excut ); |