Wordpress - Display Post from categories

2019-09-01 08:42发布

I need to display a limited post from a specific category but with a page title , little description of page and also a read more link mention it, whats the procedure to i get this or guide me some details about the wordpress coding because i am very new in it.

I dont need to paste code in page.php i need to display this only on one specific page.

Basically i want to make a custom news column on page and i need to get post from category news but limit of five and when the new post added in category automatic display on home page i try lots of plugins but i still didn't get the exact solution all the time differs that's why i need to make a proper and permanent coding.

标签: php wordpress
1条回答
来,给爷笑一个
2楼-- · 2019-09-01 09:22

Creating a custom page template and then adding wp_query on it should work. After creating the template, you can create a page then set the template to the new custom page template you created. For example: create a News Page Template. In your theme, create news-template.php then add this code:

<?php
/**
 * Template Name: News Page Template
 *
 */

// add your markup here and wp_query

?>
查看更多
登录 后发表回答