Skip to content

Instantly share code, notes, and snippets.

View manhleo93's full-sized avatar

Đức Mạnh manhleo93

View GitHub Profile
//* Customize Entry Meta Filed Under and Tagged Under
add_filter( 'genesis_post_meta', 'ig_entry_meta_footer' );
function ig_entry_meta_footer( $post_meta ) {
$post_meta = '[post_categories before=""] [post_tags before=""]';
return $post_meta;
}
@manhleo93
manhleo93 / gist:9b3352b810c4d3cf5f87d0b314d342cb
Created July 28, 2017 10:00
Hướng dẫn việt hóa chữ Filed Under và Tagged With trong Genesis Framework link: http://sampres.com/huong-dan-viet-hoa-chu-filed-va-tagged-trong-genesis-framework
[post_categories before="Thể loại: "] [post_tags before="Tagged: "]
@manhleo93
manhleo93 / functions.php
Created July 29, 2017 01:29
Code đếm thời gian vài phút trước giống facebook cho genesis framework http://sampres.com
// Đếm thời gian vài phút trước giống facebook cho genesis framework
add_filter( 'genesis_post_info', 'sp_post_info_filter' );
function sp_post_info_filter($post_info) {
if ( !is_page() ) {
$post_info = '<i class="fa fa-clock-o"></i> [post_date format="relative" relative_depth="1"] <i class="fa fa-eye"></i> [postview] [post_comments zero="0 Comments" one="1 Comment" more="% Comments"]';
return $post_info;
}}
[post_date format="relative" relative_depth="1"] By [post_author_posts_link] [post_comments zero="Comments" one="1 Comment" more="% Comments"]
[post_date format="relative" relative_depth="1"]
By [post_author_posts_link]
[post_comments zero="Comments" one="1 Comment" more="% Comments"]
// Add Post Views on Post Info
add_filter( 'genesis_post_info', 'ja_add_post_view_to_info' );
function ja_add_post_view_to_info($post_info) {
if ( !is_page() ) {
$post_info = '[post_date] by [post_author_posts_link] [post_comments] [postview] [post_edit]';
return $post_info;
}
}
// Add Post Views on Post Meta
@manhleo93
manhleo93 / style.css
Created July 29, 2017 13:27
Tùy biến mầu menu trong genesis https://sampres.com
/* Primary Navigation menu item color styles - https://sampres.com
--------------------------------------------- */
.nav-primary .redcolor a { background:#7F5217; }
.nav-primary .redcolor a:hover { background:#7F462C; }
.nav-primary .yellowcolor a { background:#FFFF00; }
.nav-primary .yellowcolor a:hover { background:#FFF380; }
.nav-primary .bluecolor a { background:#342D7E; }
.nav-primary .bluecolor a:hover { background:#15317E; }
// Shortcodes in Widgets
add_filter('widget_text', 'do_shortcode');
#Tạo shortcode genesis
function url_shortcode() {
return get_bloginfo('url');
}
add_shortcode('url','url_shortcode');
# Đếm số comment genesis
add_filter( 'genesis_title_comments', 'crunchify_title_comments');
function crunchify_title_comments() {
return __(comments_number( '<h3>Comments</h3>', '<h3>1 Comments</h3>', '<h3>% Comments</h3>' ), 'genesis' );
}
function cswp_comment_count() {
global $wpdb;
$count = $wpdb->get_var('SELECT COUNT(comment_ID) FROM ' . $wpdb->comments. ' WHERE comment_author_email = "' . get_comment_author_email() . '"');
return ''.$count.' bình luận';
}
add_filter( 'comment_author_says_text', 'cswp_comment_count' );