sitemap.php 521 B

1234567891011121314151617181920212223242526
  1. <?php
  2. /**
  3. * Sitemap shortcode.
  4. *
  5. * Usage: [sitemap]
  6. */
  7. add_shortcode( 'sitemap', 'jetpack_sitemap_shortcode' );
  8. /**
  9. * Renders a tree of pages.
  10. *
  11. * @since 4.5.0
  12. *
  13. * @return string
  14. */
  15. function jetpack_sitemap_shortcode() {
  16. $tree = wp_list_pages( array(
  17. 'title_li' => '<b><a href="/">' . esc_html( get_bloginfo( 'name' ) ) . '</a></b>',
  18. 'exclude' => get_option( 'page_on_front' ),
  19. 'echo' => false,
  20. ) );
  21. return empty( $tree )
  22. ? ''
  23. : '<ul class="jetpack-sitemap-shortcode">' . $tree . '</ul>';
  24. }