我已经在Wordpress中设置了自定义发布类型。这是客户可以上传PDF格式文件的部分。这些文件分为两类 - “可下载的表格”和“菜单”;该类别的自定义字段名称是'document_category'WordPress的 - 按邮政类型查询类别抓取项目
我想运行查询,并只显示页面上的'可下载的表单'。这里是我通常使用的代码---我希望有人可以帮我添加我需要的东西使其工作?
<?php
$args = array('post_type' => 'prep_forms', 'posts_per_page' => -1);
// The Query
$the_query = new WP_Query($args);
// The Loop
$i = 0;
while ($the_query->have_posts()) : $the_query->the_post();
?>
<li><a href="<?php echo get_field('document_pdf_file'); ?>"><?php the_title(); ?></a></li>
<?php
$i++;
endwhile;
// Reset Post Data
wp_reset_postdata();
?>
谢谢。
再次救了我。谢谢Kostis。 –
所以它工作,很好:-) – Kostis