WordPress:在手风琴视图中按类别显示帖子

问题描述 投票:0回答:0

我的投资组合页面有这个漂亮的设计enter image description here

我使用Custom Post Type UI (CPT-UI) to create Portfolio postenter image description here

我创建新文件 portfolio.php

我用这段代码来显示类别列表

<?php
//Display a list of all the categories of custom post types
$terms = get_terms(
  array(
    'taxonomy'   => 'portfolio_categories', // Custom Post Type Taxonomy Slug
    'hide_empty' => false,
    'order'         => 'asc'
  )
);

//List of all categories of custom post types                                            
echo '<ul>';
foreach ($terms as $term) {
  //echo '<li><a href="'.get_term_link($term).'">'.$term->name.'</a></li>';
  echo '<li><a href="javascript:void(0);">'.$term->name.'<i aria-hidden="true" class="fas fa-chevron-down"></i></a></li>';
}
echo '</ul>';
?>type here

成功显示类别列表enter image description here

但是我无法显示每个类别的每个帖子的内容

所以我需要你的帮助

每个投资组合的详细信息页面将使用 elementor 创建

php wordpress plugins categories
© www.soinside.com 2019 - 2024. All rights reserved.