Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
76.92% covered (warning)
76.92%
10 / 13
100.00% covered (success)
100.00%
1 / 1
CRAP
n/a
0 / 0
jetpack_sitemap_shortcode
100.00% covered (success)
100.00%
10 / 10
100.00% covered (success)
100.00%
1 / 1
2
1<?php
2/**
3 * Sitemap shortcode.
4 *
5 * Usage: [sitemap]
6 *
7 * @package automattic/jetpack
8 */
9
10if ( ! defined( 'ABSPATH' ) ) {
11    exit( 0 );
12}
13
14add_shortcode( 'sitemap', 'jetpack_sitemap_shortcode' );
15
16/**
17 * Renders a tree of pages.
18 *
19 * @since 4.5.0
20 *
21 * @return string
22 */
23function jetpack_sitemap_shortcode() {
24    $tree = wp_list_pages(
25        array(
26            'title_li' => '<b><a href="/">' . esc_html( get_bloginfo( 'name' ) ) . '</a></b>',
27            'exclude'  => get_option( 'page_on_front' ),
28            'echo'     => false,
29        )
30    );
31    return empty( $tree )
32        ? ''
33        : '<ul class="jetpack-sitemap-shortcode">' . $tree . '</ul>';
34}