Loop in WordPress Page not working

Here is my page template:

It’s not pulling the content in. Not sure what I’m missing?

<?php get_header(); ?>
    <section id="services">
        <div class="container">
            <div class="row divide">
            <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
            <h2><?php the_title(); ?></h2>
            <?php the_content(); ?>
            <?php endwhile; endif; ?>
            </div>
        </div>
    </section>
<?php get_footer(); ?>

Related posts

2 comments

  1. This code is for display post list in template. Please try it.

    get_header();
    ?>
    <section id="services">
        <div class="container">
            <div class="row divide">
                <?php
                $args = array('post_type' => 'post');
                $postlist = new WP_Query($args);
    
                if ($postlist->have_posts()) {
                    while ($postlist->have_posts()) {
                        $postlist->the_post();
                        the_title();
                        the_content();
                        // list posts here
                    }
    
                    // post pagination
                } else {
                    // no posts content
                }
                ?>
            </div>
        </div>
    </section>
    <?php get_footer();
    
  2. Try

    <?php get_header(); ?>
            <section id="services">
                <div class="container">
                    <div class="row divide">
    
          <?php      if ( have_posts() ) {
                while ( have_posts() ) {
                the_post(); 
                //
                // Post Content here 
                //
                } // end while
                } // end if
           ?>
                    </div>
                </div>
            </section>
        <?php get_footer(); ?>
    

Comments are closed.