Skip to content

Instantly share code, notes, and snippets.

@NichlasB
Created June 22, 2017 21:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NichlasB/4d1abc095a71860e19cc3ceed89602cc to your computer and use it in GitHub Desktop.
Save NichlasB/4d1abc095a71860e19cc3ceed89602cc to your computer and use it in GitHub Desktop.
Customize Genesis Framework Sitemap
<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* custom-genesis-sitemap.php
*/
add_filter( 'genesis_sitemap_output', 'vmf_sitemap' );
function vmf_sitemap() {
$heading = ( genesis_a11y( 'headings' ) ? 'h2' : 'h4' );
$sitemap = sprintf( '<%2$s>%1$s</%2$s>', __( 'Pages:', 'genesis' ), $heading );
$sitemap .= sprintf( '<ul>%s</ul>', wp_list_pages( 'title_li=&echo=0' ) );
/*
$sitemap .= sprintf( '<%2$s>%1$s</%2$s>', __( 'Categories:', 'genesis' ) , $heading );
$sitemap .= sprintf( '<ul>%s</ul>', wp_list_categories( 'sort_column=name&title_li=&echo=0' ) );
$sitemap .= sprintf( '<%2$s>%1$s</%2$s>', __( 'Authors:', 'genesis' ) , $heading );
$sitemap .= sprintf( '<ul>%s</ul>', wp_list_authors( 'exclude_admin=0&optioncount=1&echo=0' ) );
*/
$sitemap .= sprintf( '<%2$s>%1$s</%2$s>', __( 'Monthly:', 'genesis' ) , $heading );
$sitemap .= sprintf( '<ul>%s</ul>', wp_get_archives( 'type=monthly&echo=0' ) );
$sitemap .= sprintf( '<%2$s>%1$s</%2$s>', __( 'Recent Posts:', 'genesis' ) , $heading );
$sitemap .= sprintf( '<ul>%s</ul>', wp_get_archives( 'type=postbypost&limit=100&echo=0' ) );
return $sitemap;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment