Skip to content

Instantly share code, notes, and snippets.

@itsnahidhasan
Last active July 1, 2019 08:02
Show Gist options
  • Save itsnahidhasan/ffb66502006002ff44e54dfd0da2b324 to your computer and use it in GitHub Desktop.
Save itsnahidhasan/ffb66502006002ff44e54dfd0da2b324 to your computer and use it in GitHub Desktop.
Creating an HTML sitemap is a good practice. In Genesis framework its easy to create one. Here is the file.
<?php
/**
* Genesis Framework.
*
* WARNING: This file is part of the core Genesis Framework. DO NOT edit this file under any circumstances.
* Please do all modifications in the form of a child theme.
*
* @package Genesis\Templates
* @author The mushfiq.co
* @license GPL-2.0+
* @link https://mushfiq.co/
*/
//* Template Name: Sitemap
//* 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() { ?>
<?php echo genesis_html5() ? '<article>' : '<div>'; ?>
<h2><?php _e( 'Recent 100 Posts:', 'genesis' ); ?></h2>
<ul>
<?php wp_get_archives( 'type=postbypost&limit=100' ); ?>
</ul>
<hr>
<div class="mushfiq.co-class">
<h4><?php _e( 'Pages:', 'genesis' ); ?></h4>
<ul>
<?php wp_list_pages( 'title_li=' ); ?>
</ul>
</div>
<hr>
<h4><?php _e( 'Categories:', 'genesis' ); ?></h4>
<ul>
<?php wp_list_categories( 'sort_column=name&title_li=' ); ?>
</ul>
<h4><?php _e( 'Authors:', 'genesis' ); ?></h4>
<ul>
<?php wp_list_authors( 'exclude_admin=0&optioncount=1' ); ?>
</ul>
<h4><?php _e( 'Monthly:', 'genesis' ); ?></h4>
<hr>
<div class="mushfiq.co-class">
<ul>
<?php wp_get_archives( 'type=monthly' ); ?>
</ul>
</div>
<h4><?php _e("Site Feeds", "genesis"); ?></h4>
<ul>
<li><a href="<?php bloginfo('rss2_url'); ?>"><?php _e("Main RSS Feed", "genesis"); ?></a></li>
</ul>
<p style="text-align: right;"> by <a title="mushfiq.co" href="https://www.mushfiq.co//" target="_blank">mushfiq.co - Freelance SEO Expert</a></span></p>
<?php
echo genesis_html5() ? '</article>' : '</div>';
}
genesis();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment