Php 使用PODS通过查询显示pod中的变量
我有一个自定义事件播客,其中包含以下变量:url、日期、时间 到目前为止,该代码正在运行:Php 使用PODS通过查询显示pod中的变量,php,wordpress,podscms,Php,Wordpress,Podscms,我有一个自定义事件播客,其中包含以下变量:url、日期、时间 到目前为止,该代码正在运行: <?php $args = array( 'orderby' => 'date', 'post_type' => 'event', ); $the_query = new WP_Query( $args ); if ( $the_query->have_posts() ) : while ( $the_query
<?php
$args = array(
'orderby' => 'date',
'post_type' => 'event',
);
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<div><?php the_field('title');?></div>
<?php endwhile; else: ?> <p>Sorry. Calendar not up-to-date.</p> <?php endif; ?>
对不起。日历不是最新的。
重复每个事件的标题是可行的,但如何获得其他变量(“日期、时间和url”)?我这样解决:
<?php
$args = array(
'orderby' => 'datum',
'post_type' => 'event',
'orderby' => 'meta_value',
'order' => 'ASC',
'meta_query' => array(
array(
'key' => 'datum',
)
)
);
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post();
global $post;
$tours = pods('event', $post->ID);
$datum = $tours->display('datum');
$time = $tours->display('time');
$url = $tours->display('url');
[... show some div and print some variables...]
endwhile; else: ?> <p>Sorry. Calender not up-to-date.</p> <?php endif; ?>
对不起。日历不是最新的。
我是这样解决的:
<?php
$args = array(
'orderby' => 'datum',
'post_type' => 'event',
'orderby' => 'meta_value',
'order' => 'ASC',
'meta_query' => array(
array(
'key' => 'datum',
)
)
);
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post();
global $post;
$tours = pods('event', $post->ID);
$datum = $tours->display('datum');
$time = $tours->display('time');
$url = $tours->display('url');
[... show some div and print some variables...]
endwhile; else: ?> <p>Sorry. Calender not up-to-date.</p> <?php endif; ?>
对不起。日历不是最新的。
使用标题()代码>而不是_字段(“标题”)代码>使用标题()代码>而不是_字段(“标题”)代码>