Skip to content

Instantly share code, notes, and snippets.

@thachpham92
thachpham92 / gist:d57b18cf02e3550acdb5
Last active March 1, 2024 17:10
Tất cả các tham số trong WP_Query
// 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ả
@thachpham92
thachpham92 / SassMeister-input-HTML.html
Created July 14, 2015 11:07
Generated by SassMeister.com.
<div class="group">
<div class="box1"></div>
<div class="box2"></div>
<div class="box3"></div>
<div class="box4"></div>
</div>
@thachpham92
thachpham92 / functions.php
Created December 16, 2013 18:51
Remove WordPress Image Size
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');
@thachpham92
thachpham92 / gist:5656497
Created May 27, 2013 11:00
Custom comment form
//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>',
@thachpham92
thachpham92 / gist:5656492
Created May 27, 2013 11:00
Limit the_excerpt
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 );