<div class="container">
    <nav class="breadcrumbs">
        <ul>
            <?php // Breadcrumb navigation
            if (is_page() && !is_front_page() || is_single() || is_category() || is_404()) {

                echo '<li><a href="' . get_home_url() . '">Accueil</a></li>';

                if (is_page()) {
                    $ancestors = get_post_ancestors($post);

                    if ($ancestors) {
                        $ancestors = array_reverse($ancestors);
                        foreach ($ancestors as $crumb) {
                            if ($crumb !== 15) {
                                echo '<li><a href="' . get_permalink($crumb) . '">' . get_the_title($crumb) . '</a></li>';
                            }
                        }
                    }
                }
                
                if (is_category()) {
                    $category = get_the_category();
                    echo '<li>'.$category[0]->cat_name.'</li>';
                }

                // Current page
                if (is_page() || is_single()) {
                    echo '<li>'.get_the_title().'</li>';
                }

                if (is_404()) {
                    echo '<li>Erreur 404</li>';
                }
            }
            ?>
        </ul>
    </nav>
</div>