Quantcast
Channel: Crunchify
Viewing all articles
Browse latest Browse all 1037

How to Create and Customize Genesis Theme Archive / Sitemap Page? Sample Template Attached

$
0
0

How to Create and Customize Genesis Archive-Sitemap Page

Genesis WordPress themes are one of the best themes out there in market right now. Used by hundreds of thousands of users there is no doubt it is also the most customizable theme.

On Crunchify, we are using Genesis theme since 2014.

Recently we noticed, some of the new Genesis themes doesn’t come with sitemap/archive page template. So thought of sharing the same with you all.

Here is a custom sitemap archive page for Genesis Framework.

Step-1.

Create file and name it: page_archive.php

<?php
/**
 * Sitemap and Archive Page for Genesis Framework. Customized and modified by Crunchify.
 * Put this in to your child theme directory.
 *
 * @package Genesis\Templates
 * @author  Crunchify
 * @license GPL-2.0+
 * @link    https://crunchify.com/
 */

//* Template Name: Archive

//* Remove standard post content output
remove_action( 'genesis_post_content', 'genesis_do_post_content' );
remove_action( 'genesis_entry_content', 'genesis_do_post_content' );

add_action( 'genesis_entry_content', 'genesis_page_archive_content' );
add_action( 'genesis_post_content', 'genesis_page_archive_content' );
/**
 * This function outputs sitemap-esque columns displaying all pages,
 * categories, authors, monthly archives, and recent posts.
 *
 * @since 1.6
 */
function genesis_page_archive_content() { ?>

	<!-- This code shows list of all Pages on Archive page -->
	<h4><?php _e( 'Pages:', 'genesis' ); ?></h4>
	<ul>
		<?php wp_list_pages( 'title_li=' ); ?>
	</ul>

	<!-- This code shows list of all Cagegories on Archive page -->
	<h4><?php _e( 'Categories:', 'genesis' ); ?></h4>
	<ul>
		<?php wp_list_categories( 'sort_column=name&title_li=' ); ?>
	</ul>

	<!-- This code shows list of top 150 Posts on Archive page -->
	<h4><?php _e( 'Recent 150 Posts:', 'genesis' ); ?></h4>
	<ul>
		<?php wp_get_archives( 'type=postbypost&limit=150' ); ?>
	</ul>

<?php
}

genesis();

Save it to local folder on your laptop/desktop.

Step-2.

Copy file to theme’s main folder. Put it under the same directory as functions.php file.

Copy page_archive.php to theme folder

Step-3.

Create empty page called sitemap.

Create simple page sitemap without any content

Select page template Archive.

Genesis theme - select page template Archive

That’s it. Just publish a page and you are all set.

Just visit a page and you should see archive/sitemap page.

Live Example: https://crunchify.com/sitemap/

What next? Modify your 404 - Page not found page template

How to modify 404 Page Not Found template for WordPress Genesis Framework Theme?

The post How to Create and Customize Genesis Theme Archive / Sitemap Page? Sample Template Attached appeared first on Crunchify.


Viewing all articles
Browse latest Browse all 1037

Trending Articles