Site icon Anthony Carbon

Genesis category custom layout with 3 columns

Copy the codes below and follow the instructions.

FOR SPECIFIC CATEGORY

1. Create a file that named category-7.php ( NOTE : The “7” in category-7.php is the category ID of your specific category ).
2. Copy and paste the codes in your category-7.php and upload it into your genesis child theme. See codes below.

add_action( 'genesis_meta', 'custom_category_function' ); 
function custom_category_function() {   
    remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 );
    remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 );
    remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
    remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
    remove_action( 'genesis_entry_content', 'genesis_do_post_image', 8 );
    remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_open', 5 );
    remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_close', 15 );
    remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
    remove_action( 'genesis_entry_content', 'genesis_do_post_content' );
     
    add_filter( 'post_class', 'category__post_class', 15 ); 
    add_action( 'genesis_entry_content', 'genesis_entry_content_custom', 8, 1 );
    add_action( 'genesis_before_loop' , 'custom_category_page_title', 1 ); 
}
function genesis_entry_content_custom(){
    echo '<p class="post-image">';
    echo genesis_do_post_image();
    echo '</p>';
    echo '<h5>'.get_the_title().'</h5>';
    echo '<p class="content-excerpt">';
    echo get_the_excerpt();
    echo '</p>';
    echo '<div class="footer-meta">';
    echo do_shortcode( '<img src="http://www.wptaskforce.com/wp-content/uploads/2015/05/author-icon.jpg" alt="" />[post_author_posts_link]&nbsp;&nbsp;&nbsp;&nbsp;<img src="http://www.wptaskforce.com/wp-content/uploads/2015/05/date-icon.png" alt="" />[post_date format="F j, Y"]' ); 
    echo '</div>';  
}  
function category__post_class( $classes ) {
    global $wp_query;
    $classes[] = 'one-third';  
    if( $wp_query->current_post % 3 == 0 ){
        $classes[] = 'first';
    }
    return $classes; 
} 

GENERAL CATEGORY LAYOUT

1. Create a file that named category.php.
2. Copy and paste the codes below on category.php and upload it into your genesis child theme.
2. Copy and paste the codes in your category.php and upload it into your genesis child theme. See codes below.

add_action( 'genesis_meta', 'custom_category_function' ); 
function custom_category_function() {   
    remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 );
    remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 );
    remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
    remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
    remove_action( 'genesis_entry_content', 'genesis_do_post_image', 8 );
    remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_open', 5 );
    remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_close', 15 );
    remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
    remove_action( 'genesis_entry_content', 'genesis_do_post_content' );
     
    add_filter( 'post_class', 'category__post_class', 15 ); 
    add_action( 'genesis_entry_content', 'genesis_entry_content_custom', 8, 1 );
    add_action( 'genesis_before_loop' , 'custom_category_page_title', 1 ); 
}
function genesis_entry_content_custom(){
    echo '<p class="post-image">';
    echo genesis_do_post_image();
    echo '</p>';
    echo '<h5>'.get_the_title().'</h5>';
    echo '<p class="content-excerpt">';
    echo get_the_excerpt();
    echo '</p>';
    echo '<div class="footer-meta">';
    echo do_shortcode( '<img src="http://www.wptaskforce.com/wp-content/uploads/2015/05/author-icon.jpg" alt="" />[post_author_posts_link]&nbsp;&nbsp;&nbsp;&nbsp;<img src="http://www.wptaskforce.com/wp-content/uploads/2015/05/date-icon.png" alt="" />[post_date format="F j, Y"]' ); 
    echo '</div>';  
}  
function category__post_class( $classes ) {
    global $wp_query;
    $classes[] = 'one-third';  
    if( $wp_query->current_post % 3 == 0 ){
        $classes[] = 'first';
    }
    return $classes; 
} 
Exit mobile version