0
我使用PODS创建自定义帖子类型。我想在我的自定义模板中显示这些帖子类型。我已经能够显示标题,图像,但还没有找到显示正文内容的方式。我已经尝试get_the_content($id)
没有运气。有任何想法吗?显示自定义帖子的正文文本
<?php
$pod = pods('selectoffers');
$related = $pod->field('select');
if (! empty($related)) {
foreach ($related as $rel) {
$id = $rel[ 'ID' ];?>
<div class="col-lg-4">
<div class="round-img img-circle" style="background-image:url('<?php echo pods_image_url(get_post_meta($id, 'bilde', true), $size = 'full'); ?>');"></div>
<h2><?php echo get_the_title($id); ?></h2>
<p> [[THIS IS WHERE I WANT TO ADD THE BODY]] </p>
<p><a class="btn btn-default" href="<?php $lenke = get_post_meta($id, 'lenke', true);
echo esc_url(get_permalink(array_shift($lenke))); ?>" role="button">Les mer »</a></p>
</div><!-- /.col-lg-4 -->
<?php
} //end of foreach
} //endif ! empty ($related)
?>
the_content()是你想要的功能,但你为什么不使用循环? – David
如果已尝试both_content()和the_content($ id),但它们都不返回任何内容。不使用循环是什么意思? – janlindso
如果你是谷歌WP循环,你应该找到循环中的负载,这基本上是一组函数来创建模板。 the_content只能在循环中使用(你需要这个函数有几个原因) – David