drruhc4944 2014-08-20 18:00
浏览 18

获取Wordpress ACF分类标准并添加到类别

I am using ACF to get the taxonomy, How to I get $place (which is the selected taxonomy) and add it to the installgallery_places post query? My code is:

<?php $place = get_field('choose_place', 'installgallery_places'); $args = array( 'post_type'=> 'installgallery', 'installgallery_places'=> '$place' );
$the_query = new WP_Query( $args ); if($the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>

  • 写回答

2条回答 默认 最新

  • dongpang2483 2014-08-21 07:55
    关注

    I believe you can do it like that

     $args = array( 
        'post_type'=> 'installgallery', 
        'meta_query' => array(
                          array(
                            'key' => 'installgallery_places',
                             'value' => $place,
                             )
                        )
    
    
      );
    

    Maybe it could work with you original code if you remove the single quotes around the variable $place

    评论

报告相同问题?

悬赏问题

  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)