Skip to content

Instantly share code, notes, and snippets.

@damiencarbery
Last active October 5, 2019 10:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save damiencarbery/6dd9308906a7b7c19cc1f3be734296be to your computer and use it in GitHub Desktop.
Save damiencarbery/6dd9308906a7b7c19cc1f3be734296be to your computer and use it in GitHub Desktop.
From Genesis WordPress Facebook group - blog page in two columns
<?php
// Copy to theme directory as home.php
// Display content archive in two columns using flexbox.
// By Damien Carbery, https://www.damiencarbery.com
// 29 September 2019
add_action( 'wp_head', 'dcwd_flex_css' );
function dcwd_flex_css() {
?>
<style>
.blog .flex { display: flex; flex-wrap: wrap; }
.blog article { flex-basis: 50%; }
</style>
<?php
}
// Add a div around the posts to apply flex styles to.
add_action( 'genesis_before_while', 'dcwd_open_flex_div' );
function dcwd_open_flex_div() {
?>
<div class="flex">
<?php
}
add_action( 'genesis_after_endwhile', 'dcwd_close_flex_div', 5 );
function dcwd_close_flex_div() {
?>
</div>
<?php
}
// Show featured image before post title.
add_action( 'genesis_entry_header', 'dcwd_show_featured_image', 8 );
function dcwd_show_featured_image() {
if ( has_post_thumbnail() ) {
the_post_thumbnail();
}
}
// Just show post date, not author or comment info.
add_filter( 'genesis_post_info', 'dcwd_post_info' );
function dcwd_post_info( $post_info ) {
return '[post_date]';
}
// Remove the Filed and Tagged info.
remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
//* Run the Genesis loop
genesis();
@deeman
Copy link

deeman commented Oct 2, 2019

Does not work or where is suppose to be pasted into what file?

@damiencarbery
Copy link
Author

The first comment in the file says: Copy to theme directory as home.php
If you want to use it for a category archive then copy it to archive.php.

@deeman
Copy link

deeman commented Oct 4, 2019

The first comment in the file says: Copy to theme directory as home.php
If you want to use it for a category archive then copy it to archive.php.

Does it, what line?

@damiencarbery
Copy link
Author

It said it up until 3 hours ago when I changed it to help Laura. (https://gist.github.com/damiencarbery/6dd9308906a7b7c19cc1f3be734296be/revisions)
I'll revert as the Template Name wasn't needed to fix the issue on her site.

@deeman
Copy link

deeman commented Oct 5, 2019

It said it up until 3 hours ago when I changed it to help Laura. (https://gist.github.com/damiencarbery/6dd9308906a7b7c19cc1f3be734296be/revisions)
I'll revert as the Template Name wasn't needed to fix the issue on her site.

Thanks, I'll give it another try. Cheers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment