You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Dokan插件的店铺列表及店铺单页隐藏商家头像?

隐藏Dokan商家头像的两种方法(店铺列表+商家单页)

方法一:CSS代码实现

直接通过CSS隐藏对应的头像元素,操作简单,适合不想修改PHP代码的情况:

/* 隐藏店铺列表中的商家头像 */
.dokan-store-listing .store-thumbnail {
    display: none !important;
}

/* 隐藏商家单页的头像 */
.dokan-single-store .store-header .store-avatar {
    display: none !important;
}

把这段代码添加到你的WordPress主题的自定义CSS面板(外观→自定义→额外CSS),或者主题文件夹下的style.css文件末尾即可。

方法二:PHP代码实现(通过functions.php)

如果想从代码层面彻底移除头像的渲染,可以通过Dokan提供的钩子来实现,把以下代码添加到当前主题的functions.php文件中:

// 移除店铺列表中的商家头像
add_filter('dokan_store_listing_thumbnail_html', '__return_empty_string');

// 移除商家单页的头像
add_filter('dokan_store_header_avatar_html', '__return_empty_string');

注意:修改functions.php前建议先备份文件,避免代码错误导致网站异常。

内容的提问来源于stack exchange,提问作者Puspal

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.12 11:12:02