How to display posts from a wordpress on a homepage

-1

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

    
asked by anonymous 16.12.2016 / 00:54

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();
    
05.01.2017 / 23:38