我正在为旅行社建立一个wordpress网站,该旅行社向各个地点提供特殊优惠并将其显示在一页上。因此,我使用以下代码来过滤我设置的自定义帖子类型,并显示各个帖子摘录和图像。
这是我所拥有的:
<code>
<?php
/**
* Template Name: Deals 1 column
*/
get_header(); ?>
<div id="content" class="two_third <?php echo of_get_option('blog_sidebar_pos') ?>">
<div id="sort">
<h5>SORT BY : </h5>
<ul>
<li><a href="<?php echo add_query_arg(array ('paged' => '1', 'orderby' => 'date', 'order' => 'DESC'));?>">Date</a></li>
<li><a href="<?php echo add_query_arg(array ('paged' => '1', 'orderby' => 'title', 'order' => 'ASC'));?>">Deal (A to Z)</a></li>
<li><a href="<?php echo add_query_arg(array ('paged' => '1', 'orderby' => 'meta_value', 'order' => 'ASC', 'meta_key' => 'price'));?>">price (A to Z)</a></li>
</ul>
</div>
<div id="filter"> …Run Code Online (Sandbox Code Playgroud) 我确信这很简单,但如果不打破我的页面,我就无法得到这个:
<?php
$values = get_field('testimonial_text');
if($values) {
echo '
<div class="testimonial entry-content">
<h2><?php the_field('testimonial_title'); ?></h2>
<?php the_field('testimonial_text'); ?>
</div>';
} else {
echo '';
}
?>
Run Code Online (Sandbox Code Playgroud)
有人能告诉我我做错了什么,为什么我做的不行.