A
A
Alexander Konovalov2018-08-13 20:17:35
WordPress
Alexander Konovalov, 2018-08-13 20:17:35

How to display posts on specific pages?

Hello! I have a website on WP, created several pages and now I need to display my posts on each of these pages. That is, on one page such records, and on the other others. How can I do that?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Grimashevich, 2018-08-13
@Huf

Alternatively, create templates for the pages - files of the catalog.php type, where at first it will be written:
/**
*
* Template name: Catalog
*
*/
Then below is the cycle itself:
$query = new Wp_Query('post_type=catalog&showposts=5' );
if ($query->have_posts()) :
while($query->have_posts()) : $query->the_post();
the_title();
endwhile.
wp_reset_post_data();
endif;
Everything is individual, so the code above is an example, there may be a bunch of other solutions depending on the tasks

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question