Skip to content

Instantly share code, notes, and snippets.

@mjsdiaz
Last active May 15, 2018 17:59
Show Gist options
  • Save mjsdiaz/8f5df3be0e1fd3c897158e0c89ac5a89 to your computer and use it in GitHub Desktop.
Save mjsdiaz/8f5df3be0e1fd3c897158e0c89ac5a89 to your computer and use it in GitHub Desktop.
Genesis Archive template showing only blog posts
<?php
/**
*
* Template Name: Archive
*
* Adapted from Genesis Framework page_archive.php
*
* @category Amethyst-v2
* @package Templates
* @subpackage Archive
* @author Amethyst Website Design
* @license GPL-2.0+
* @link http://amethyst.dev
*/
// Remove standard post content output.
remove_action( 'genesis_entry_content', 'genesis_do_post_content' );
add_action( 'genesis_entry_content', 'amethyst_page_archive_content' );
remove_action( 'genesis_after_entry', 'genesis_get_comments_template' );
/**
* This function outputs all recent posts.
*/
function amethyst_page_archive_content() {
the_content(); // In case you want some page content.
$postargs = array(
'type' => 'postbypost',
'limit' => '100',
);
?>
<h4><?php esc_html_e( 'Recent Posts:', 'amethyst-v2' ); ?></h4>
<ul>
<?php wp_get_archives( $postargs );
?>
</ul>
<?php
}
genesis();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment