<?php
/**
 * Template for displaying pages
 *
 * @package Paws_And_Care
 * @since 1.0.0
 */

get_header();

// Get sidebar layout settings
$sidebar_layout = paws_and_care_get_sidebar_layout();

// Page Header
get_template_part( 'template-parts/page-header', null, array(
    'title'       => get_the_title(),
    'subtitle'    => has_excerpt() ? get_the_excerpt() : '',
    'breadcrumbs' => array(
        array( 'label' => __( 'Home', 'paws-and-care' ), 'url' => home_url( '/' ) ),
        array( 'label' => get_the_title() ),
    ),
) );
?>

    <!-- Page Content -->
    <section id="primary-content" class="py-5">
        <div class="container">
            <div class="row">
                <div class="<?php echo esc_attr( trim( $sidebar_layout['content_class'] . ' ' . $sidebar_layout['content_order'] ) ); ?>">
                    <?php
                    while ( have_posts() ) :
                        the_post();
                        ?>
                        <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
                            <div class="entry-content">
                                <?php
                                the_content();

                                wp_link_pages( array(
                                    'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'paws-and-care' ),
                                    'after'  => '</div>',
                                ) );
                                ?>
                            </div>
                        </article>
                        <?php
                        // 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;
                    ?>
                </div>

                <?php if ( $sidebar_layout['show_sidebar'] ) : ?>
                    <!-- Sidebar -->
                    <div class="<?php echo esc_attr( trim( $sidebar_layout['sidebar_class'] . ' ' . $sidebar_layout['sidebar_order'] ) ); ?>">
                        <?php get_sidebar(); ?>
                    </div>
                <?php endif; ?>
            </div>
        </div>
    </section>

<?php
get_footer();

