How to display posts using the_content()?

0 like 0 dislike
109 views
I want on the page displays a blog. I implemented it this way:

<?php/*Template Name: Страница с постами*/?><?php get_header() ?><?php if(have_posts()) : while (have_posts()) : the_post(); ?><?php the_title(); ?><?php the_content(); ?><?php endwhile; endif; ?><?php get_footer() ?>


That is, make a separate page template blog. But in the end the function the_title() prints the title and not the title of the post, and the function the_content() does not output anything at all.

And I would like to tranice was all the posts I've created, i.e. the title of the post and below the text, well, actually, it can be seen in the HTML markup.
asked by | 109 views

1 Answer

0 like 0 dislike
<?php\r$query = new WP_Query( array('post_type' => 'post', 'posts_per_page'=>-1 ); ?> <?php if($query->have_posts()) : while ($query->have_posts()) : $query->the_post(); ?> \r<?php the_title(); ?>\r<?php the_content(); ?>\r\r<?php endwhile; endif; ?>

Look for more information here
answered by

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
24,509 questions
45,931 answers
0 comments
308 users