2020年betheme加入国内社交化分享完美攻略(修改后亲测有效)

网站设计知识:交互设计中常见的基本术语
2020年10月9日
betheme主题使用自定义css修改模块样式
2020年10月15日

betheme主题的社交化功能比较尴尬,分享到国外的utobe,脸书等网站,可是这些网站在国内基本打不开呀,所以就成为了鸡肋功能,也有一些国内主题发布网站修改了这一块,但是好多都有问题,还是自己动手丰衣足食吧,铬元素来分享一下现版本比较有效的办法,先来看一下最终效果:

1 先来把制作好的css文件以及用到的图标分享给大家:链接:https://pan.baidu.com/s/1mkQsq64VX5LzmlugdDS5mg       提取码:x4ay

下载好文件以后,打开,放在/fonts目录。

2   mfn-icons-add.css放在/fonts目录,后台设置面板用,icons-add.css放在/css目录,前台用;

 

3 引入css文件

后台设置引入,修改/muffin-options/options.php文件,大概在160行,版本变动,可以搜索_enqueue()函数,将红色的复制添加

wp_enqueue_style( ‘mfn-opts-icons’, THEME_URI. ‘/fonts/mfn-icons.css’, false, time(), ‘all’);
wp_enqueue_style( ‘mfn-opts-font’, ‘http’. mfn_ssl() .’://fonts.googleapis.com/css?family=Open+Sans:400,400italic,600′ );
//新增社会化分享新增
wp_enqueue_style(‘mfn-opts-icons-add’, THEME_URI. ‘/fonts/mfn-icons-add.css’, false, time(), ‘all’);

4 前台页面引入,修改/functions/theme-head.php文件,在123行,在if( ! function_exists( ‘mfn_styles’ ) )中,依然是将红色代码复制添加:

if( ! isset( $theme_disable[‘entrance-animations’] ) ){
wp_enqueue_style( ‘mfn-animations’, THEME_URI .’/assets/animations/animations.min.css’, false, THEME_VERSION, ‘all’ );
}

wp_enqueue_style( ‘mfn-jquery-ui’, THEME_URI .’/assets/ui/jquery.ui.all.css’, false, THEME_VERSION, ‘all’ );
wp_enqueue_style( ‘mfn-jplayer’, THEME_URI .’/assets/jplayer/css/jplayer.blue.monday.css’, false, THEME_VERSION, ‘all’ );
//增加本地社会化分享
wp_enqueue_style(‘mfn-icons-add’, THEME_URI .’/css/icons-add.css’, false, THEME_VERSION, ‘all’);

5 后台图标框显示增加的图标,修改/muffin-options/fields/icon/field_icon.php文件,在423行后面添加自己增加的图标:

<?php
class MFN_Options_icon extends MFN_Options{

private $icons = array(

/* — 我的字体包增加的内容 —*/
‘icon-qzone’,
‘icon-tqq’,
‘icon-wechat’,
‘icon-bilibili’,
‘icon-douyin’,
‘icon-owelltube’,
‘icon-xuangu’,
‘icon-ar’,
‘icon-acfun’,
‘icon-lofter’,
‘icon-vr1’,
‘icon-vr2’,
‘icon-weishi’,
‘icon-iqiybg’,
‘icon-partner’,
‘icon-huaban’,
‘icon-knowledge’,
‘icon-kaixin’,
‘icon-kuaishou’,
‘icon-taobaobg’,
‘icon-vqq’,
‘icon-tqqbg’,
‘icon-team’,
‘icon-wangyi’,
‘icon-huoshan’,
‘icon-zcool’,
‘icon-commerce’,
‘icon-learning’,
‘icon-jdbg’,
‘icon-mibg’,
‘icon-alipay’,
‘icon-iqiy’,
‘icon-jd’,
‘icon-taobao’,
‘icon-mi’,
‘icon-owell’,
‘icon-youku’,

);

6 修改/muffin-options/theme-options.php文件,搜索$sections[‘social’] = array,在这个数组里加入红色部分代码:

array(
‘id’ => ‘social-rss’,
‘type’ => ‘switch’,
‘title’ => __(‘RSS’, ‘mfn-opts’),
‘desc’ => __(‘Show the RSS icon’, ‘mfn-opts’),
‘options’ => array(‘1’ => ‘On’,’0′ => ‘Off’),
‘std’ => ‘0’
),
array(
‘id’ => ‘social-weibo’,
‘type’ => ‘text’,
‘title’ => __(‘微博’, ‘mfn-opts’),
‘desc’ => __(‘Link to the profile page’, ‘mfn-opts’),
),
array(
‘id’ => ‘social-renren’,
‘type’ => ‘text’,
‘title’ => __(‘人人’, ‘mfn-opts’),
‘desc’ => __(‘Link to the profile page’, ‘mfn-opts’),
),
array(
‘id’ => ‘social-qq’,
‘type’ => ‘text’,
‘title’ => __(‘QQ’, ‘mfn-opts’),
‘desc’ => __(‘Link to the profile page’, ‘mfn-opts’),
),
array(
‘id’ => ‘social-wechat’,
‘type’ => ‘text’,
‘title’ => __(‘微信’, ‘mfn-opts’),
‘desc’ => __(‘Link to the profile page’, ‘mfn-opts’),
),
array(
‘id’ => ‘social-qzone’,
‘type’ => ‘text’,
‘title’ => __(‘QQ空间’, ‘mfn-opts’),
‘desc’ => __(‘Link to the profile page’, ‘mfn-opts’),
),
array(
‘id’ => ‘social-tqq’,
‘type’ => ‘text’,
‘title’ => __(‘腾讯微博’, ‘mfn-opts’),
‘desc’ => __(‘Link to the profile page’, ‘mfn-opts’),
),
array(
‘id’ => ‘social-bilibili’,
‘type’ => ‘text’,
‘title’ => __(‘哔哩哔哩’, ‘mfn-opts’),
‘desc’ => __(‘Link to the profile page’, ‘mfn-opts’),
),
array(
‘id’ => ‘social-youku’,
‘type’ => ‘text’,
‘title’ => __(‘优酷’, ‘mfn-opts’),
‘desc’ => __(‘Link to the profile page’, ‘mfn-opts’),
),
array(
‘id’ => ‘social-douyin’,
‘type’ => ‘text’,
‘title’ => __(‘抖音’, ‘mfn-opts’),
‘desc’ => __(‘Link to the profile page’, ‘mfn-opts’),
),
array(
‘id’ => ‘social-owell’,
‘type’ => ‘text’,
‘title’ => __(‘欧威创艺’, ‘mfn-opts’),
‘desc’ => __(‘Link to the profile page’, ‘mfn-opts’),
),
array(
‘id’ => ‘social-owelltube’,
‘type’ => ‘text’,
‘title’ => __(‘欧威影音’, ‘mfn-opts’),
‘desc’ => __(‘Link to the profile page’, ‘mfn-opts’),
),
array(
‘id’ => ‘social-xuangu’,
‘type’ => ‘text’,
‘title’ => __(‘玄谷’, ‘mfn-opts’),
‘desc’ => __(‘Link to the profile page’, ‘mfn-opts’),
),
array(
‘id’ => ‘social-iqiy’,
‘type’ => ‘text’,
‘title’ => __(‘爱奇艺’, ‘mfn-opts’),
‘desc’ => __(‘Link to the profile page’, ‘mfn-opts’),
),
array(
‘id’ => ‘social-vqq’,
‘type’ => ‘text’,
‘title’ => __(‘腾讯视频’, ‘mfn-opts’),
‘desc’ => __(‘Link to the profile page’, ‘mfn-opts’),
),
array(
‘id’ => ‘social-weishi’,
‘type’ => ‘text’,
‘title’ => __(‘微视’, ‘mfn-opts’),
‘desc’ => __(‘Link to the profile page’, ‘mfn-opts’),
),
array(
‘id’ => ‘social-taobao’,
‘type’ => ‘text’,
‘title’ => __(‘淘宝’, ‘mfn-opts’),
‘desc’ => __(‘Link to the profile page’, ‘mfn-opts’),
),
array(
‘id’ => ‘social-jd’,
‘type’ => ‘text’,
‘title’ => __(‘京东’, ‘mfn-opts’),
‘desc’ => __(‘Link to the profile page’, ‘mfn-opts’),
),
array(
‘id’ => ‘social-zcool’,
‘type’ => ‘text’,
‘title’ => __(‘站酷’, ‘mfn-opts’),
‘desc’ => __(‘Link to the profile page’, ‘mfn-opts’),
),

7 修改/includes/include-social.php文件,在12行,这个文件是对应图标的执行方法,你可以按自己的要求修改,比如我将微信的图标修改为鼠标悬停显示二维码,其他玩法就自己修改吧。

 

if( mfn_opts_get( ‘social-custom-icon’ ) && mfn_opts_get( ‘social-custom-link’ ) ){
echo ‘<li class=”custom”><a ‘.$target.’ href=”‘. esc_url( mfn_opts_get( ‘social-custom-link’ ) ) .'”><i class=”‘. esc_attr( mfn_opts_get( ‘social-custom-icon’ ) ) .'”></i></a></li>’;

if( mfn_opts_get(‘social-weibo’) ) echo ‘<li class=”weibo”><a ‘.$target.’ href=”‘. mfn_opts_get(‘social-weibo’) .'” title=”微博”><i class=”icon-weibo”></i></a></li>’;
if( mfn_opts_get(‘social-renren’) ) echo ‘<li class=”renren”><a ‘.$target.’ href=”‘. mfn_opts_get(‘social-renren’) .'” title=”人人”><i class=”icon-renren”></i></a></li>’;
if( mfn_opts_get(‘social-qq’) ) echo ‘<li class=”qq”><a ‘.$target.’ href=”‘. mfn_opts_get(‘social-qq’) .'” title=”QQ”><i class=”icon-qq”></i></a></li>’;
if( mfn_opts_get(‘social-wechat’) ) echo ‘<li class=”wechat”><a class=”tooltip tooltip-img” style=”cursor: pointer;border: 0px;”><span class=”tooltip-content” style=”width: 170px;bottom: 50px;left: 75px;”><img src=”‘. mfn_opts_get(‘social-wechat’) .'” alt=””></span><i class=”icon-wechat”></i></a></li>’;
if( mfn_opts_get(‘social-qzone’) ) echo ‘<li class=”qzone”><a ‘.$target.’ href=”‘. mfn_opts_get(‘social-qzone’) .'” title=”QQ空间”><i class=”icon-qzone”></i></a></li>’;
if( mfn_opts_get(‘social-tqq’) ) echo ‘<li class=”tqq”><a ‘.$target.’ href=”‘. mfn_opts_get(‘social-tqq’) .'” title=”腾讯微博”><i class=”icon-tqq”></i></a></li>’;
if( mfn_opts_get(‘social-bilibili’) ) echo ‘<li class=”bilibili”><a ‘.$target.’ href=”‘. mfn_opts_get(‘social-bilibili’) .'” title=”哔哩哔哩”><i class=”icon-bilibili”></i></a></li>’;
if( mfn_opts_get(‘social-douyin’) ) echo ‘<li class=”douyin”><a ‘.$target.’ href=”‘. mfn_opts_get(‘social-douyin’) .'” title=”抖音”><i class=”icon-douyin”></i></a></li>’;
if( mfn_opts_get(‘social-youku’) ) echo ‘<li class=”youku”><a ‘.$target.’ href=”‘. mfn_opts_get(‘social-youku’) .'” title=”优酷”><i class=”icon-youku”></i></a></li>’;
if( mfn_opts_get(‘social-owell’) ) echo ‘<li class=”owell”><a ‘.$target.’ href=”‘. mfn_opts_get(‘social-owell’) .'” title=”欧威创艺”><i class=”icon-owell”></i></a></li>’;
if( mfn_opts_get(‘social-owelltube’) ) echo ‘<li class=”owelltube”><a ‘.$target.’ href=”‘. mfn_opts_get(‘social-owelltube’) .'” title=”欧威影音”><i class=”icon-owelltube”></i></a></li>’;
if( mfn_opts_get(‘social-xuangu’) ) echo ‘<li class=”xuangu”><a ‘.$target.’ href=”‘. mfn_opts_get(‘social-xuangu’) .'” title=”玄谷”><i class=”icon-xuangu”></i></a></li>’;
if( mfn_opts_get(‘social-iqiy’) ) echo ‘<li class=”iqiy”><a ‘.$target.’ href=”‘. mfn_opts_get(‘social-iqiy’) .'” title=”爱奇艺”><i class=”icon-iqiy”></i></a></li>’;
if( mfn_opts_get(‘social-vqq’) ) echo ‘<li class=”vqq”><a ‘.$target.’ href=”‘. mfn_opts_get(‘social-vqq’) .'” title=”腾讯视频”><i class=”icon-vqq”></i></a></li>’;
if( mfn_opts_get(‘social-weishi’) ) echo ‘<li class=”weishi”><a ‘.$target.’ href=”‘. mfn_opts_get(‘social-weishi’) .'” title=”微视”><i class=”icon-weishi”></i></a></li>’;
if( mfn_opts_get(‘social-taobao’) ) echo ‘<li class=”taobao”><a ‘.$target.’ href=”‘. mfn_opts_get(‘social-taobao’) .'” title=”淘宝”><i class=”icon-taobao”></i></a></li>’;
if( mfn_opts_get(‘social-jd’) ) echo ‘<li class=”jd”><a ‘.$target.’ href=”‘. mfn_opts_get(‘social-jd’) .'” title=”京东”><i class=”icon-jd”></i></a></li>’;
if( mfn_opts_get(‘social-zcool’) ) echo ‘<li class=”zcool”><a ‘.$target.’ href=”‘. mfn_opts_get(‘social-zcool’) .'” title=”站酷”><i class=”icon-zcool”></i></a></li>’;

 

这样就修改完毕了,稍微麻烦一点哈,主要是这些改动文件寻找起来稍显麻烦,不过改过来后效果还是挺好的。分享给大家,转发请注明本攻略由石家庄网站设计铬元素工作室原创整理.

发表评论

电子邮件地址不会被公开。 必填项已用*标注