我想从这个区域提取数据“查看下面图片上的红色区域”。

输出到特定的模板
我有一个名为page.php的页面模板
<div class="contentholder">
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', 'page' ); ?>
<?php comments_template( '', false ); ?>
<?php endwhile; // end of the loop. ?>
<br />
</div>但这只是给我一个评论字段..。我需要这一页的文字
我需要头像
发布于 2013-01-17 10:20:58
在查询循环中,此函数将输出当前的posts标题:
the_title();此函数将输出以下内容:
the_content();然而,我怀疑的是,您正在调用get_template_part( 'content', 'page' );,并期望它输出页面的内容,而它实际上正在做的是检查是否存在content-page.php,如果它是存在的,则包括它是否存在,如果没有,它检查content.php并包含它,因为它们都不存在,所以您没有得到任何内容。
有关get_template_part实际工作的更多细节,请参见以下内容:
http://codex.wordpress.org/Function_参考/获取_模板_零件
编辑*
工作片段:
<?php while ( have_posts() ) : the_post(); ?>
<?php the_title(); ?>
<?php the_content(); ?>
<?php endwhile; // end of the loop. ?>https://wordpress.stackexchange.com/questions/81954
复制相似问题