diff options
Diffstat (limited to 'plugins/jetpack/modules/shortcodes/sitemap.php')
-rw-r--r-- | plugins/jetpack/modules/shortcodes/sitemap.php | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/plugins/jetpack/modules/shortcodes/sitemap.php b/plugins/jetpack/modules/shortcodes/sitemap.php new file mode 100644 index 00000000..d26210f0 --- /dev/null +++ b/plugins/jetpack/modules/shortcodes/sitemap.php @@ -0,0 +1,30 @@ +<?php +/** + * Sitemap shortcode. + * + * Usage: [sitemap] + * + * @package Jetpack + */ + +add_shortcode( 'sitemap', 'jetpack_sitemap_shortcode' ); + +/** + * Renders a tree of pages. + * + * @since 4.5.0 + * + * @return string + */ +function jetpack_sitemap_shortcode() { + $tree = wp_list_pages( + array( + 'title_li' => '<b><a href="/">' . esc_html( get_bloginfo( 'name' ) ) . '</a></b>', + 'exclude' => get_option( 'page_on_front' ), + 'echo' => false, + ) + ); + return empty( $tree ) + ? '' + : '<ul class="jetpack-sitemap-shortcode">' . $tree . '</ul>'; +} |