Skip to content

Instantly share code, notes, and snippets.

@mjsdiaz
Created January 5, 2018 16:49
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 mjsdiaz/5f01eff52c286aa216ef2ca2d2793ad0 to your computer and use it in GitHub Desktop.
Save mjsdiaz/5f01eff52c286aa216ef2ca2d2793ad0 to your computer and use it in GitHub Desktop.
Genesis Archive page showing all pages, categories, recent posts, and portfolio items.
<?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 pages,
* categories, recent posts, and portfolio items.
*/
function amethyst_page_archive_content() {
// In case you want some page content.
the_content();
$catargs = array(
'orderby' => 'name',
'order' => 'ASC',
'style' => 'list',
'exclude' => '16', // Exclude Portfolio List.
'hide_empty' => 1,
'title_li' => '',
);
$pageargs = array(
'orderby' => 'name',
'order' => 'ASC',
'exclude' => '1183, 1617, 3095', // Client Forms Pages.
'style' => 'list',
'title_li' => '',
);
$postargs = array(
'type' => 'postbypost',
'limit' => '100',
);
$cptpostargs = array(
'type' => 'postbypost',
'post_type' => 'portfolio',
'limit' => '50',
);
?>
<div class="one-half first">
<h4><?php esc_html_e( 'Pages:', 'amethyst-v2' ); ?></h4>
<ul>
<?php wp_list_pages( $pageargs ); ?>
<li><a href="/portfolio">Portfolio</a></li>
</ul>
</div>
<div class="one-half">
<h4><?php esc_html_e( 'Categories:', 'amethyst-v2' ); ?></h4>
<ul>
<?php wp_list_categories( $catargs ); ?>
</ul>
</div>
<h4 class="clear"><?php esc_html_e( 'Portfolio:', 'amethyst-v2' ); ?></h4>
<ul>
<?php wp_get_archives( $cptpostargs );
?>
</ul>
<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