追格小程序配置过程中都要配置固定链接/%category%/ ,但链接又特别长,不太好看,比如:
比如:https://www.zhuige.com/888/999/1.html,888是父分类,999是子分类。
如果想把父分类删除,可以将下面代码添加到当前WordPress模板函数functions.php中:
add_filter( 'post_link', 'zhuige_remove_parent_cats_from_link', 10, 3 );
function zhuige_remove_parent_cats_from_link( $permalink, $post, $leavename ){
$cats = get_the_category( $post->ID );
if ( $cats ) {
usort( $cats, '_usort_terms_by_ID' );
$category = $cats[0]->slug;
if ( $parent = $cats[0]->parent ) {
$parentcats = get_category_parents( $parent, false, '/', true );
$permalink = str_replace( $parentcats, '', $permalink );
}
}
return $permalink;
}
-
Loco Translate 一款专为WordPress设计的翻译插件WordPress Loco Translate是一款专为WordPress用户设计的翻译插件,它简化了主题和插件的多语言翻译过程。
-
追格小程序V2.5.0更新发布追格小程序V2.5.0版本的更新,我们没给大家添太多新花样,主要是把“内功”练好了。我们认真检查了上一版里那些组件之间的小摩擦,一点点地调整、优化,搞定了超过40多个小地方。这样一来,小程序跑起来就更顺畅了,大家用起来也会感觉更舒服、更顺手。这次虽然没大张旗鼓,但确实是让产品站得更稳、更可靠了。
-
WordPress后台待审文章显示气泡提示的方法之前小编分享过一篇《WordPress 后台菜单添加 badge-红点提示(气泡通知)》的文章,今天我简单说说待审文章(为全部文章类型显示待审角标提示)的气泡提示如何操作。
-
2024年国庆放假通知追格2024年国庆节放假有关事宜通知如下
-
FluentSMTP一款功能强大且免费的WordPress SMTP插件FluentSMTP是一款功能强大且免费的SMTP插件,它支持为WordPress配置多个SMTP发送服务器。
-
追格小程序V2.5.8更新发布追格小程序是一款采用积木式理念的微信小程序构建框架,它巧妙融合了Uniapp与WordPress技术,打造出一个开源且无加密限制的开发环境。
暂无评论,抢个沙发...