Skip to content

Instantly share code, notes, and snippets.

@mjsdiaz
Last active May 15, 2018
Embed
What would you like to do?
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