-
-
Save bryanwillis/498ac1cac08ffb9d939d to your computer and use it in GitHub Desktop.
Splitting Posts into columns in Magazine Pro. http://sridharkatakam.com/splitting-posts-columns-magazine-pro/
This file contains hidden or 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 | |
| //* Do NOT include the opening php tag | |
| add_action( 'get_header', 'sk_posts_in_columns' ); | |
| function sk_posts_in_columns() { | |
| if ( is_home() || is_archive() ) { | |
| //* Display as columns | |
| add_filter( 'post_class', 'sk_display_in_columns' ); | |
| //* Remove Featured image from Entry Content | |
| remove_action( 'genesis_entry_content', 'genesis_do_post_image', 8 ); | |
| //* Show Featured image below Post info | |
| add_action( 'genesis_entry_header', 'sk_do_post_image', 12 ); | |
| //* Modify the Excerpt read more link | |
| add_filter('excerpt_more', 'new_excerpt_more'); | |
| } | |
| } | |
| function sk_display_in_columns( $classes ) { | |
| $columns = 3; // Set the number of columns here | |
| $column_classes = array( '', '', 'one-half', 'one-third', 'one-fourth', 'one-fifth', 'one-sixth' ); | |
| $classes[] = $column_classes[$columns]; | |
| global $wp_query; | |
| if( 0 == $wp_query->current_post || 0 == $wp_query->current_post % $columns ) | |
| $classes[] = 'first'; | |
| return $classes; | |
| } | |
| function sk_do_post_image() { | |
| // $image_args = array( | |
| // 'size' => 'blog-featured-image' | |
| // ); | |
| // echo '<div class="home-featured-image"><a href="' . get_permalink() . '">' . genesis_get_image( $image_args ) . '</a></div>'; | |
| echo '<div class="home-featured-image"><a href="' . get_permalink() . '">' . genesis_get_image() . '</a></div>'; | |
| } | |
| function new_excerpt_more($more) { | |
| return ' ...<a class="more-link" href="' . get_permalink() . '">[Read More...]</a>'; | |
| } |
This file contains hidden or 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
| .blog .archive-pagination { | |
| clear: both; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment