0
votes

I am building a custom wordpress theme. I want to get my posts on my frontpage

I added this in my front-page.php

        <?php
            if ( have_posts() ) {
                // Start the Loop.
                while ( have_posts() ) {
                    the_post();

                    /*
                     * Include the Post-Format-specific template for the content.
                     * If you want to override this in a child theme, then include a file
                     * called content-___.php (where ___ is the Post Format name) and that will be used instead.
                     */
                    get_template_part( 'template-parts/content', 'archive' );
                }
            } 
        ?>

content-archive.php

I have this

<div class="container">
<article class="post">
    <div class="post-preview col-10  no-gutter">
        <h2><a href="<?php the_permalink();?>"><?php the_title(); ?></a></h2>
        <p><?php the_excerpt(); ?></p>
        <p class="meta">
            <a href="author.html"><?php the_modified_author();?></a> in <a href="category.html"><?php the_category();?></a> <i class="link-spacer"></i> <i class="fa fa-bookmark"></i> 23 minute read
        </p>
    </div>
    <div class=" col-2  no-gutter">
        <img src="img/profile-1.jpg" class="user-icon" alt="user-image">
    </div>
</article>

When I visited the current homepage, I get the homepage as post and its snipper, then read more button.

What I am trying to pull are the posts.

1

1 Answers

0
votes

Update content-archive.php to:

<div class="container">
<article class="post">
    <div class="post-preview col-10  no-gutter">
        <h2><a href="<?php the_permalink();?>"><?php the_title(); ?></a></h2>
        <p><?php the_content(); ?></p>
        <p class="meta">
            <a href="author.html"><?php the_modified_author();?></a> in <a href="category.html"><?php the_category();?></a> <i class="link-spacer"></i> <i class="fa fa-bookmark"></i> 23 minute read
        </p>
    </div>
    <div class=" col-2  no-gutter">
        <img src="img/profile-1.jpg" class="user-icon" alt="user-image">
    </div>
</article>