dongtanjian9310 2012-07-06 00:27
浏览 20
已采纳

如何通过使用另一个post_type的新主题中的标签检索帖子

How can I retrieve the post by tags in New theme that is using another post_type

For example, I am building a cinema site..

The site is

For movies - I am using post - The movies are post there.. For actors - I am using post_type : persoane , Taxonomy : lista.

How can I retrieve the movies play by bruce willis in


This movie have Bruce Willis Tag....( this is a regular post in wp)

In Bruce Willis page I want to retrieve the movie.... that have Bruce Willis Tag

In conclusion I want to display the movies that actor play in

I anny body know please help.

  • 写回答

1条回答 默认 最新

  • douqinlu4217 2012-07-06 01:38
    关注

    Not sure but you can give it a try

    $args = array(
    'tax_query' => array(
        array(
            'taxonomy' => 'lista',
            'field' => 'slug',
            'terms' => get_query_var('term')
        )
    )
    );
    $query = new WP_Query( $args );
    while ( $query->have_posts() ) : $query->the_post();
        echo  the_title().'<br />';
        echo the_content();
    endwhile;
    wp_reset_postdata();
    

    Take a look at this.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 目详情-五一模拟赛详情页
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line