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
Code lấy bài viết mặc định | |
<!-- Get post mặt định --> | |
<?php if (have_posts()) : ?> | |
<?php while (have_posts()) : the_post(); ?> | |
<?php endwhile; else : ?> | |
<p>Không có</p> | |
<?php endif; ?> | |
<!-- Get post mặt định --> | |
Đoạn code đặt trong index sẽ lấy list bài viết mới nhất, Đặt trong category sẽ lấy danh sách bài viết của category đó, đặt trong single sẽ lấy nội dung của bài đó!. |
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 excerpt_read_more( $more ){ | |
return '<a href="' . get_permalink() . '" rel="nofollow"> Read More</a>'; | |
add_filter( 'excerpt_more', 'excerpt_read_more' ); | |
} |
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 custom_excerpt_length($length) { | |
return 30; | |
} | |
add_filter('excerpt_length', 'custom_excerpt_length'); |
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 count_p( $insertion, $paragraph_id, $content ) { | |
$end_p = '</p>'; | |
$paragraphs = explode( $end_p, $content ); | |
foreach ($paragraphs as $index => $paragraph) { | |
if ( trim( $paragraph ) ) { | |
$paragraphs[$index] .= $end_p; | |
} | |
if ( $paragraph_id == $index + 1 ) { | |
$paragraphs[$index] .= $insertion; | |
} |
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
<ul> | |
<li class="gia_khac">Sắp xếp <i class="icon-angle-down"></i> | |
<ul class="dropdown woocommerce-ordering"> | |
<?php | |
$catalog_orderby = apply_filters( 'woocommerce_catalog_orderby', array( | |
'menu_order' => __( 'Default sorting', 'woocommerce' ), | |
'popularity' => __( 'Sort by popularity', 'woocommerce' ), | |
'rating' => __( 'Sort by average rating', 'woocommerce' ), |
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
// Tùy chỉnh các tùy chọn sắp xếp sản phẩm WooCommerce | |
// Tùy chọn có sẵn là: menu_order, xếp hạng, ngày, mức độ phổ biến, giá, giá-desc | |
function custom_woocommerce_product_sorting( $orderby ) { | |
// The following removes the rating, date, and the popularity sorting options; | |
// feel free to customize and enable/disable the options as needed. | |
unset($orderby["rating"]); | |
unset($orderby["date"]); | |
unset($orderby["popularity"]); | |
return $orderby; | |
} |
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
<?php | |
function filter_cars_by_taxonomies( $post_type, $which ) { | |
// Apply this only on a specific post type | |
if ( 'car' !== $post_type ) | |
return; | |
// A list of taxonomy slugs to filter by | |
$taxonomies = array( 'manufacturer', 'model', 'transmission', 'doors', 'color' ); |
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 html5wp_pagination() | |
{ | |
global $wp_query; | |
$big = 999999999; | |
$pages = paginate_links(array( | |
'base' => str_replace($big, '%#%', get_pagenum_link($big)), | |
'format' => '?paged=%#%', | |
'current' => max(1, get_query_var('paged')), | |
'total' => $wp_query->max_num_pages, | |
'type' => 'array', |
OlderNewer