Skip to content

Instantly share code, notes, and snippets.

View manhleo93's full-sized avatar

Đức Mạnh manhleo93

View GitHub Profile
li.custom-list {
padding-right: 0;
margin-left: 0;
list-style-type: none;
counter-increment: step-counter;
padding-bottom: 15px;
margin-top: 15px;
margin-bottom: 15px;
display: flex;
}
@manhleo93
manhleo93 / functions.php
Created July 24, 2017 13:23
Xem hướng dẫn tại sampres.com
//* Đếm lượt xem trong genesis framework
function getPostViews($postID){
$count_key = 'post_views_count';
$count = get_post_meta($postID, $count_key, true);
if($count==''){
delete_post_meta($postID, $count_key);
add_post_meta($postID, $count_key, '0');
return "0 Views";
}
return $count.' Views';
# Chèn đoạn shortcode bên dưới vào plugin Genesis Simle edit
[post_views]
// Register front-page widget areas
for ( $i = 1; $i <= 5; $i++ ) {
genesis_register_widget_area(
array(
'id' => "front-page-{$i}",
'name' => __( "Front Page {$i}", 'my-theme-text-domain' ),
'description' => __( "This is the front page {$i} section.", 'my-theme-text-domain' ),
)
);
}
<?php
// Enqueue styles
wp_enqueue_style( 'front-styles', get_stylesheet_directory_uri() . '/style-front.css', array(), CHILD_THEME_VERSION );
/**
* Add attributes for site-inner element, since we're removing 'content'.
*
* @param array $attributes Existing attributes.
* @return array Amended attributes.
.site-inner.full {
padding: 0;
max-width: none;
}
.front-page-section {
padding: 150px 0;
}
.front-page-section:nth-child(odd) {
//* Grid Style Content Archive
function be_archive_post_class( $classes ) {
// Don't run on single posts or pages
if( !is_home() )
return $classes;
$classes[] = 'one-half';
global $wp_query;
if( 0 == $wp_query->current_post || 0 == $wp_query->current_post % 2 )
$classes[] = 'first';
return $classes;
<a title="Nhận ưu đãi lên đến 40% khi mua hosting tốc độ cao tại Hawk Host" href="#">
<img src="http://sampres.com/wp-content/uploads/2017/07/hawk-host-off-sale.jpg" alt="banner" />
</a>
<a href="http://Twitter.com" target="_blank" rel="noopener">Twitter</a>
<a href="http://facebook.com" target="_blank" rel="noopener">Facebook</a>
<a href="http://plus.google.com" target="_blank" rel="noopener">Google+</a>
<a href="http://Pinterest.com" target="_blank" rel="noopener">Pinterest</a>
<a href="http://YouTube.com" target="_blank" rel="noopener">YouTube</a>
//* Xóa Entry Meta Filed Under and Tagged Under trong genesis
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;
}