Php 使用循环获取特定帖子,以填写站点的特定区域
是否可以使用循环来查询特定帖子,并在我的页面上显示帖子内容、标题和自定义字段 我的想法是:Php 使用循环获取特定帖子,以填写站点的特定区域,php,wordpress,Php,Wordpress,是否可以使用循环来查询特定帖子,并在我的页面上显示帖子内容、标题和自定义字段 我的想法是: if (have_posts() && the_post().id == 66) : while (have_posts()) : the_post(); 听起来您需要使用query\u posts()p=post\u id(1) 所以如果我想显示ID为66的帖子,它应该是这样的('p=66')? <?php query_posts('p=1'); ?> <?php
if (have_posts() && the_post().id == 66) : while (have_posts()) : the_post();
听起来您需要使用
query\u posts()
p=post\u id(1)
所以如果我想显示ID为66的帖子,它应该是这样的('p=66')?
<?php query_posts('p=1'); ?>
<?php while (have_posts()) : the_post(); ?>
<?php the_title(); ?>
<?php the_content(); ?>
<?php endwhile; ?>