Skip to content

Instantly share code, notes, and snippets.

View manhleo93's full-sized avatar

Đức Mạnh manhleo93

View GitHub Profile
// Apply Full Width Content layout to Posts page, Single Posts and Archives.
add_action( 'get_header', 'sk_set_full_layout' );
function sk_set_full_layout() {
if ( ! ( is_home() || is_singular( 'post' ) || is_archive() ) ) {
return;
}
// Force full width content
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
}
<pre>
Nơi chèn nội dung code html, php, css, txt..
</pre>
add_action( 'get_header', 'sk_set_404_layout' );
/**
* Force full width content on 404 pages
*
* @author Sridhar Katakam
*/
function sk_set_404_layout() {
if ( ! is_404() ) {
return;
}
// Change 'genesis_html5_comment_callback' to 'gtcn_basic_callback' provided by Greg's Threaded Comment Numbering plugin for numbering commnets
add_filter( 'genesis_comment_list_args', 'sk_add_numbered_comments' );
function sk_add_numbered_comments( $defaults ) {
if ( function_exists( 'gtcn_basic_callback' ) ) {
$defaults['callback'] = genesis_html5() ? 'gtcn_basic_callback' : 'genesis_comment_callback';
}
return $defaults;
.commentnumber {
float: right;
font-size: 12px;
background: #ddd;
padding: 5px 10px;
}
add_filter( 'manage_media_columns', 'sk_media_columns_url' );
/**
* Filter the Media list table columns to add a URL column.
*
* @param array $posts_columns Existing array of columns displayed in the Media list table.
* @return array Amended array of columns to be displayed in the Media list table.
*/
function sk_media_columns_url( $posts_columns ) {
$posts_columns['media_url'] = 'URL';
return $posts_columns;
// Register Horizontal Opt-in widget area
genesis_register_widget_area(
array(
'id' => 'horizontal-opt-in',
'name' => __( 'Horizontal Opt-in', 'my-theme-text-domain' ),
'description' => __( 'This is the horizontal opt-in section.', 'my-theme-text-domain' ),
)
);
// Display Horizontal Opt-in widget area below header
jQuery(function($){
// $('.post-listing').append( '<button class="load-more">Load More</button>' );
// var button = $('.post-listing .load-more');
var page = 2;
var loading = false;
$('body').on('click', '.load-more', function(){
if( ! loading ) {
loading = true;
remove_action( 'genesis_after_entry', 'genesis_do_author_box_single', 8);
add_action('genesis_after_entry', 'theme_author_box', 8);
function theme_author_box() {
$authinfo = "<div class=\"postauthor\">\r\n";
$authinfo .= get_avatar(get_the_author_id() , 100);
$authinfo .= "<h4>". get_the_author_meta('display_name') ."</h4>\r\n";
$authinfo .= "<p>" . get_the_author_meta('description') . "</p>\r\n";
$authinfo .= "</div>\r\n";
$facebook = get_the_author_meta('facebook');