1.4 – Sitemap

Ho creato, nel tema child, un template di pagina per visualizzare la sitemap in html.

<?php
/**
 * Template Name: Sitemap
 *
 * Template per la visualizzazione della sitemap
 *
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
 *
 * @package _incubationchild
 */
get_header();
?>
        <main id="primary" class="site-main col-12 col-md-8">
        <?php the_breadcrumb(); ?>
        <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
                <header class="entry-header">
                    <?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
                </header><!-- .entry-header -->
                <?php _incubation_post_thumbnail(); ?>
                <div class="entry-content">
            <?php
            while ( have_posts() ) :
                the_post();
                the_content();
                get_template_part( 'template-parts/content', 'sitemap' );
                // If comments are open or we have at least one comment, load up the comment template.
                if ( comments_open() || get_comments_number() ) :
                    comments_template();
                endif;
            endwhile; // End of the loop.
            ?>
                </div><!-- .entry-content -->
<?php if ( get_edit_post_link() ) : ?>
    <footer class="entry-footer">
        <?php
        edit_post_link(
            sprintf(
                wp_kses(
                    /* translators: %s: Name of current post. Only visible to screen readers */
                    __( 'Edit <span class="screen-reader-text">%s</span>', '_incubation' ),
                    array(
                        'span' => array(
                            'class' => array(),
                        ),
                    )
                ),
                wp_kses_post( get_the_title() )
            ),
            '<span class="edit-link">',
            '</span>'
        );
        ?>
    </footer><!-- .entry-footer -->
<?php endif; ?>
</article><!-- #post-<?php the_ID(); ?> -->
        </main><!-- #main -->
<?php
get_sidebar();
get_footer();

Questo template usa la parte relativa alla funzione di generazione tramite get_template_part richiamando il file content-sitemap.php del tema parent.

<?php
/**
 * Porzione di template per la visualizzazione della Mappa del sito
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
 *
 * @package _incubation
 */
?>
                                    <h2 id="pages">Pagine</h2>
                                        <ul>
                                            <?php // Add pages you'd like to exclude in the exclude here
                                                wp_list_pages( array( 'exclude' => '',
                                                'title_li' => '',
                                              )
                                            );
                                                wp_list_categories ( array( 'exclude' => '',
                                                'title_li' => '',
                                              )
                                            );
                                            ?>
                                        </ul>
                                    <h2 id="authors">Contributori</h2>
                                        <ul>
                                            <?php wp_list_authors( array( 'exclude_admin' => false,
                                              )
                                            );
                                            ?>
                                        </ul>