【发布时间】:2017-01-29 13:31:09
【问题描述】:
我想在 Easy Digital Downloads 插件中编辑结帐、收据和其他页面。
作为他们的documentation,我已将该文件复制到我当前主题的文件夹/edd_templates/
实际上,我有 2 个不同的类别(研讨会、软件),我正在寻找一种方法来显示 不同的表格 用于 每个单独的结帐页面强>这些类别。
所以,我试着用这个:
<?php
$args = array(
'post_per_page' => '-1',
'post_type' => 'download',
'tax_query' => array(
array(
'taxonomy' => 'download_category',
'field' => 'slug',
'terms' => 'workshop'
)
)
);
$my_posts = get_posts( $args );
if ( $my_posts ) :
?>
// custom html table for first category goes here... //
<?php endif; ?>
<?php
$args1 = array(
'post_per_page' => '-1',
'post_type' => 'download',
'tax_query' => array(
array(
'taxonomy' => 'download_category',
'field' => 'slug',
'terms' => 'software'
)
)
);
$myy_posts = get_posts( $args1 );
if ( $myy_posts ) :
?>
// custom html table for second category goes here... //
<?php endif; ?>
但无论您属于哪个类别,它都会在结帐页面中显示两个表格...
我认为问题在于我已经告诉 wordpress 显示这些 html 表格,只要这些类别中有东西。不要过滤它们...
我该如何解决这个问题?
【问题讨论】:
标签: php wordpress wordpress-theming taxonomy