我想在一个家长的帖子下创建一些未来的帖子,在这种情况下,在think中relationship in WordPress 帖子对我来说是更好的选择。所以任何知道我的问题的人。
如何在WordPress中创建子帖子和父帖子?
1 个回复
SO网友:Anas Siddiqui
首先,你可以知道子帖子和父帖子之间的关系,试着找出它,或者试试下面的代码
$query = new WP_Query( array(
\'post_parent\' => get_theID(),
\'posts_per_page\' => 3, //shows only 3 children. If you want to show all of them, comment this line
));
while($query->have_posts()) {
$query->the_post();
/*Output the child markup here*/
the_content(); //Outputs child\'s content as it is
}
wp_reset_query();
?>结束