SOHO创业

如何在WordPress中通过post文章ID获取分类名称

这是个简单的方法,在WordPress中列出一篇文章的所属类别名称。通过以下这段代码就可以实现。

$postId = 1;
//note: if you code in single.php, do not need to pass the id
$categories = get_the_category($postId);

//iterate categories and print $category->cat_name
foreach($categories as $category){
    echo '<a href="' . get_category_link($category) . '">' . $category->cat_name . '</a>';
}
Published
Categorized as 建站知识 Tagged

By SOHO

wowsoho.com是一个关注跨境电商、创业话题的网站。

推荐10个外贸建站模板

一个好的外贸网站要看着美观,要运行稳定,要易于维护管理,因此,选择一个简洁实用的wordpress模板来建站至关重要。

建一个外贸独立站大约多少钱

外贸独立站因为独特的优势,越来越被做外贸的跨境电商所青睐。简站主题经常接到做外贸的老板咨询,建一个wordpr… Continue reading 建一个外贸独立站大约多少钱

不能赚钱的外贸网站都是垃圾网站

一个不能赚钱的外贸网站,无论它的设计多么精美,功能多么强大,都毫无价值。

非插件方式为wordpress添加一个额外的编辑器

在WordPress中,要添加一个额外的区块编辑器,你需要编写一些PHP代码来注册新的区块,并可能还需要一些JavaScript来处理前端的逻辑。

The best foreign trade website building company in Shenzhen

Waimaoyes is a company specializing in foreign trade website construction, mainly providing WordPress multilingual foreign trade small language website construction services.

wordpress企业网站模板包含的页面

常见wordpress企业网站模板包含的页面