How to display wordpress posts on a home page

Asked

Viewed 45 times

-1

Well, I wanted to know what function I use to display all my blog articles in a theme I’m creating, I’ve reviewed the internet and found nothing. would be with a get_posts?

1 answer

0


Use the code below:

get_header();
    if (have_posts()): 
        foreach ($posts as $post) : setup_postdata($post); 
              the_title();
        endforeach; // foreach($posts
        wp_reset_postdata(); 
    endif;
get_footer();

Browser other questions tagged

You are not signed in. Login or sign up in order to post.