Create WordPress page details

All types of page are showed here.

  • Create file called content-page.php under the directory called template-parts, add the below codes

<div class="container">
    <?php the_title( '<h2>', '</h2>' ); ?>
    <div class="page-content">
        <?php the_content(); ?>
    </div>
</div>
  • Now create a file called page.php and add below codes

<?php get_header() ?>

    <div class="container">
        <div class="row">
            <div class="col-md-10">
                <?php
                if ( have_posts() ) :
                    while ( have_posts() ) : the_post();
                        get_template_part("template-parts/content", "page");
                    endwhile;
                endif;
                ?>
            </div>
            <div class="col-md-2">
                <div id="right-sidebar" class="sidebar">
                    <?php dynamic_sidebar( 'h2wp-right-sidebar' ); ?>
                </div>
            </div>
        </div>
    </div>


<?php get_footer() ?>