作者:mobiledu2502863683 | 来源:互联网 | 2023-07-24 08:36
Inthebelowcodetheresaloopthatfeaturesallproductsunderagivencategory:在下面的代码中,有一个循环,其中
In the below code there's a loop that features all products under a given category:
在下面的代码中,有一个循环,其中包含给定类别下的所有产品:
In this loop, I'd like to pull out every product for a given category (that's what the code does now), but display then "per subcategory", like this:
在这个循环中,我想拉出给定类别的每个产品(这就是代码现在所做的),但是然后显示“每个子类别”,如下所示:
For category publications:
对于类别出版物:
Books:
图书:
- Book 33
- 书33
- Book 32
- 书32
- Book 1
- 书1
- ...
- ...
Mobile Apps:
移动应用:
- App 12
- 应用12
- App 76
- 应用76
- ...
- ...
...
...
I think the code above needs a foreach
loop, like below, but I don't know how to implement it in this case.
我认为上面的代码需要一个foreach循环,如下所示,但我不知道在这种情况下如何实现它。
term_id;
// Make a header for the categories
echo "".$cat->name."
";
// create a custom wordpress query
query_posts("cat=$cat_id&post_per_page=100");
// start the wordpress loop!
if (have_posts()) : while (have_posts()) : the_post(); ?>
'; ?>
2 个解决方案