小编Mat*_*ell的帖子

合并相同标题下的条款,除非new =创建新的标题Wordpress查询

在'foreach'循环期间,如果检测到相同的术语,则只添加页面链接,否则在单个wp_query期间添加术语名称和页面链接?

例如:

  1. 标题1 Apple Pie
  2. 标题1樱桃馅饼
  3. 标题2火腿馅饼
  4. 标题3山羊派
  5. 标题1面条蛋糕

应该成为:

    • 标题1
      • 苹果派,
      • 樱桃派,
      • 面条蛋糕
    • 标题2
      • 火腿馅饼
    • 标题3
      • 山羊馅饼
<?php 

$alternate_edition_a = array(
            'post_type'=> 'alternate_edition',
            'post_status' => 'publish',
            'posts_per_page'=>10,
            'no_found_rows' => true,
          'tax_query' => array(
        array(
        'taxonomy' => 'game_titles',
        'field' => 'slug', 
        'terms' => $gametitle_con,
        )
    )
);
$alternate_edition_query = new WP_Query( $alternate_edition_a );
if($alternate_edition_query->have_posts() ) : while ( $alternate_edition_query->have_posts() ) : $alternate_edition_query->the_post();

$alternate_editionTitlesID[] = get_the_ID(); 

$systemformats_altedition_terms = get_the_terms($post->id, 'system_formats');

foreach ($systemformats_altedition_terms as $systemformats_altedition_term) {

if (!has_term($systemformats_altedition_term->slug, 'system_formats', $gameFeatTitleID)) {

    $systemterm_slug[] …
Run Code Online (Sandbox Code Playgroud)

php arrays wordpress foreach wp-query

5
推荐指数
1
解决办法
160
查看次数

标签 统计

arrays ×1

foreach ×1

php ×1

wordpress ×1

wp-query ×1