Please enable / Bitte aktiviere JavaScript!
Veuillez activer / Por favor activa el Javascript![ ? ]
How to display posts using the_content()? - bug-code.com Q&A

How to display posts using the_content()?

0 like 0 dislike
167 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 | 167 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
Welcome to Bug-code Q&A, where you can ask questions and receive answers from other members of the community.

24.8k questions

46.2k answers

0 comments

12.8k users

24,788 questions
46,220 answers
0 comments
12,813 users