説明なし

sitemap.php 562B

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