如何在该主题的任何地方隐藏特定的类别名称?

你好,

我知道这不是一个新主题, 但已经进行了讨论, 但是我需要在网站上的任何位置隐藏名为” Nolink”的特定帖子类别的名称, 并且尝试了几件事之后, 似乎没有任何效果。

我不知道是否是因为我使用的主题是:http://bridge92.qodeinteractive.com/, 但找不到使它起作用的方法。

有任何想法吗?

提前致谢


#1


通过编辑functions.php文件的简单解决方案:

function exclude_category( $query ) {
    $query->set( 'cat', '-4' );
}
add_action( 'pre_get_posts', 'exclude_category' );

这样做是从全局获取帖子查询中省略特定的帖子类别。确保将” 4″替换为你要忽略的类别的ID。希望这可以帮助!

来源:

https://www.srcmini02.com/65369.html

微信公众号
手机浏览(小程序)

Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_40968.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?