php - 如何使用元框?
问题描述
我使用元,它在 wordpress 中工作,但它不能在站点中显示值
$tecno_testimonial_post =new WP_Query(
array(
'post_type'=>'testimonial',
'posts_per_page'=> $testimonial_count, ));
if($tecno_testimonial_post ->have_posts()):while($tecno_testimonial_post ->have_posts()):$tecno_testimonial_post ->the_post(); ?>
<div class="testimonial-block-two col-lg-6 col-md-12 col-sm-12">
<div class="inner-box">
<div class="upper-box">
<div class="quote-icon flaticon-two-quotes"></div> <div class="author-info">
<h3>
<?php $my_meta = get_post_meta($post->ID, '_my_meta',true); ?>
<?php if(isset($my_meta['customer']) && !empty($my_meta['customer'])) : ?>
<?php echo $my_meta['customer']; ?>
<?php endif; ?>
</h3>
<div class="designation">
<?php $my_meta = get_post_meta($post->ID, '_my_meta',true); ?>
<?php if(isset($my_meta['position']) && !empty($my_meta['position'])) : ?>
<?php echo $my_meta['position']; ?>
<?php endif; ?>
它无法在网站中显示客户和位置
解决方案
<?php
$tecno_testimonial_post =new WP_Query(
array(
'post_type'=>'testimonial',
'posts_per_page'=> $testimonial_count,
));
if($tecno_testimonial_post ->have_posts()):while($tecno_testimonial_post ->have_posts()):$tecno_testimonial_post ->the_post();
?>
<!-- Testimonial Block Two -->
<?php $id = get_the_ID();
?>
<div class="testimonial-block-two col-lg-6 col-md-12 col-sm-12">
<div class="inner-box">
<div class="upper-box">
<div class="quote-icon flaticon-two-quotes"></div>
<div class="author-info">
<h3>
<?php $my_meta = get_post_meta($id, '_my_meta',true); ?>
<?php if(isset($my_meta['customer']) && !empty($my_meta['customer'])) : ?>
<?php echo $my_meta['customer']; ?>
<?php endif; ?>
</h3>
推荐阅读
- jquery - 单击按钮后如何操作元素的内部html
- node.js - 我如何等待 nodejs 请求承诺对象
- mysql - 使用 docker 将 sql 转储插入 mysql 时出错
- swift - 如何通过 iMessage 扩展发送 GIF 图片
- android - Android - 如何让 recyclerview ListAdpater 停止闪烁?
- sql - 是否可以查看字符串是否包含 [多个] 字典单词?
- python - xpath 在使用请求时返回空列表,但适用于 selenium
- python - 如何在 XML 文件中执行单位转换
- node.js - 如何在共享主机(Namecheap)上托管反应和节点应用程序而不会在重新加载时中断
- c# - Selenium 中的陈旧元素参考