先上代码:public function render_social_icons( $args ) {
global $smof_data;

$this->args = $args; if( isset( $this->args['sharingbox'] ) && $this->args['sharingbox'] == 'yes' ) {
$social_networks = $this->get_sharingbox_social_links_array( $this->args );
} elseif( isset( $this->args['authorpage'] ) && $this->args['authorpage'] == 'yes' ) {
$social_networks = $this->get_authorpage_social_links_array( $this->args );
} else {
$social_networks = $this->get_social_links_array();
}

/*if( ! array_key_exists( 'custom', $smof_data['social_icon_ordering'] ) ) {
$smof_data['social_icon_ordering']['custom'] = array();
}*/

//$social_networks = $this->order_array_like_array( $social_networks, $smof_data['social_icon_ordering']['custom'] );
//

if( isset( $smof_data['social_sorter'] ) && $smof_data['social_sorter'] ) {
$order = $smof_data['social_sorter'];
$ordered_array = explode(',', $order); if( isset( $ordered_array ) && $ordered_array && is_array( $ordered_array ) ) {
$social_networks_old = $social_networks;
$social_networks = array();
foreach( $ordered_array as $key => $field_order ) {
$field_order_number = str_replace(  'social_sorter_', '', $field_order );
$find_the_field = $smof_data['social_sorter_' . $field_order_number];
$field_name = str_replace( '_link', '', $smof_data['social_sorter_' . $field_order_number] ); if( $field_name == 'google' ) {
$field_name = 'googleplus';
} elseif($field_name == 'email' ) {
$field_name = 'mail';
} if( ! isset( $social_networks_old[$field_name] ) ) {
continue;
} $social_networks[$field_name] = $social_networks_old[$field_name];
}
}
} if( isset( $social_networks_old['custom'] ) && $social_networks_old['custom'] ) {
$social_networks['custom'] = $social_networks_old['custom'];
} $icon_colors = explode( '|', $this->args['icon_colors'] );
$num_of_icon_colors = count( $icon_colors ); $box_colors = explode( '|', $this->args['box_colors'] );
$num_of_box_colors = count( $box_colors ); $html = $icons = ''; for( $i = 0; $i < count( $social_networks ); $i++ ) {
if( $num_of_icon_colors == 1 ) {
$icon_colors[$i] = $icon_colors[0];
} if( $num_of_box_colors == 1 ) {
$box_colors[$i] = $box_colors[0];
}
} $i = 0;
foreach( $social_networks as $network => $link ) {
$custom = '';
if( $network == 'custom' ) {
$custom = sprintf( '<img src="%s" alt="%s" />', $smof_data['custom_icon_image'], $smof_data['custom_icon_name'] ); $network = 'custom_' . $smof_data['custom_icon_name']; } $icon_options = array( 
'social_network'  => $network, 
'social_link'  => $link, 
); if( isset( $icon_colors[$i] ) && $icon_colors[$i] ) {
$icon_options['icon_color'] = $icon_colors[$i];
} else {
$icon_options['icon_color'] = '';
} if( isset( $box_colors[$i] ) && $box_colors[$i] ) {
$icon_options['box_color'] = $box_colors[$i];
} else {
$icon_options['box_color'] = '';
}

$icons .= sprintf( '<a %s>%s</a>', fusion_attr( 'social-icons-class-icon', $icon_options ), $custom );
$i++;
}

if( $icons ) {
if( isset( $this->args['position'] ) && ( $this->args['position'] == 'header' ||
$this->args['position'] == 'footer' )
) {
$html = sprintf( '<div %s>%s</div>', fusion_attr( 'social-icons-class-social-networks' ), $icons );
} else {
$html = sprintf( '<div %s>%s<div class="fusion-clearfix"></div></div>', fusion_attr( 'social-icons-class-social-networks' ), $icons );
}
} return $html;
} function social_networks_attr() { $attr['class'] = 'fusion-social-networks'; if( $this->args['icon_boxed'] == 'Yes' ) {
$attr['class'] .= ' boxed-icons';
} return $attr; }  function icon_attr( $args ) {
global $smof_data; $attr = array();
$attr['class'] = '';
$attr['style'] = ''; if( substr( $args['social_network'], 0, 7 ) === 'custom_' ) {
$attr['class'] .= 'custom ';
$tooltip = str_replace( 'custom_', '', $args['social_network'] );
$args['social_network'] = strtolower( $tooltip );
} else {
$tooltip = ucfirst( $args['social_network'] );
} $attr['class'] .= sprintf( 'fusion-social-network-icon fusion-tooltip fusion-%s fa fa-%s', $args['social_network'], $args['social_network'] ); $link = $args['social_link']; if( $this->args['linktarget'] ) {
$attr['target'] = '_blank';
}

if( $args['social_network'] == 'mail' ) {
$link = 'mailto:' . str_replace( 'mailto:', '', $args['social_link'] );
$attr['target'] = '_self';
} $attr['href'] = $link; if( $smof_data['nofollow_social_links'] ) {
$attr['rel'] = 'nofollow';
} if( $args['icon_color'] ) {
$attr['style'] = sprintf( 'color:%s;', $args['icon_color'] );
} if( strtolower( $this->args['icon_boxed'] ) == 'yes' && 
$args['box_color']
) {
$attr['style'] .= sprintf( 'background-color:%s;border-color:%s;', $args['box_color'], $args['box_color'] );
} if( strtolower( $this->args['icon_boxed'] ) == 'yes' &&
$this->args['icon_boxed_radius'] || $this->args['icon_boxed_radius'] === '0'
) {
if( $this->args['icon_boxed_radius'] == 'round' ) {
$this->args['icon_boxed_radius'] = '50%';
} $attr['style'] .= sprintf( 'border-radius:%s;', $this->args['icon_boxed_radius'] );
} if( strtolower( $this->args['tooltip_placement'] ) != 'none' ) {
$attr['data-placement'] = strtolower( $this->args['tooltip_placement'] );
if( $tooltip == 'google-plus' ) {
$tooltip = 'Google+';
}
$attr['data-title'] = $tooltip;
$attr['data-toggle'] = 'tooltip';
}

$attr['title'] = $tooltip; return $attr; }
       function get_sharingbox_social_links_array( $args ) {
global $smof_data; $social_links_array = array(); if( $smof_data['sharing_facebook'] ) {
$social_link = 'http://www.facebook.com/sharer.php?m2w&s=100&p&#91;url&#93;=' . $args['link'] . '&p&#91;images&#93;&#91;0&#93;=' . wp_get_attachment_url( get_post_thumbnail_id( get_the_ID() ) ) . '&p&#91;title&#93;=' . rawurlencode( $args['title'] );
$social_links_array['facebook'] = $social_link;
}

if( $smof_data['sharing_weibo'] ) {
$social_link = 'http://www.weibo.com/sharer.php?m2w&s=100&p&#91;url&#93;=' . $args['link'] . '&p&#91;images&#93;&#91;0&#93;=' . wp_get_attachment_url( get_post_thumbnail_id( get_the_ID() ) ) . '&p&#91;title&#93;=' . rawurlencode( $args['title'] );
$social_links_array['weibo'] = $social_link;
}
return $social_links_array;
}
无视微博的链接,那个是测试用的。
说明:前面的是处理部分,后面的是参数部分,首先
 function get_sharingbox_social_links_array( $args ) {
global $smof_data; $social_links_array = array(); if( $smof_data['sharing_facebook'] ) {
$social_link = 'http://www.facebook.com/sharer.php?m2w&s=100&p&#91;url&#93;=' . $args['link'] . '&p&#91;images&#93;&#91;0&#93;=' . wp_get_attachment_url( get_post_thumbnail_id( get_the_ID() ) ) . '&p&#91;title&#93;=' . rawurlencode( $args['title'] );
$social_links_array['facebook'] = $social_link;
}

if( $smof_data['sharing_weibo'] ) {
$social_link = 'http://www.weibo.com/sharer.php?m2w&s=100&p&#91;url&#93;=' . $args['link'] . '&p&#91;images&#93;&#91;0&#93;=' . wp_get_attachment_url( get_post_thumbnail_id( get_the_ID() ) ) . '&p&#91;title&#93;=' . rawurlencode( $args['title'] );
$social_links_array['weibo'] = $social_link;
}
return $social_links_array;
} $smof_data['sharing_facebook']和$smof_data['sharing_weibo'] 都返回True
但是在处理部分处理的过程中,Facebook的链接显示正常,Weibo则不显示,分析后发现Weibo这个参数并没有递交到function icon_attr( $args ) {
global $smof_data; $attr = array();
$attr['class'] = '';
$attr['style'] = ''; if( substr( $args['social_network'], 0, 7 ) === 'custom_' ) {
$attr['class'] .= 'custom ';
$tooltip = str_replace( 'custom_', '', $args['social_network'] );
$args['social_network'] = strtolower( $tooltip );
} else {
$tooltip = ucfirst( $args['social_network'] );
} $attr['class'] .= sprintf( 'fusion-social-network-icon fusion-tooltip fusion-%s fa fa-%s', $args['social_network'], $args['social_network'] ); $link = $args['social_link']; if( $this->args['linktarget'] ) {
$attr['target'] = '_blank';
}

if( $args['social_network'] == 'mail' ) {
$link = 'mailto:' . str_replace( 'mailto:', '', $args['social_link'] );
$attr['target'] = '_self';
} $attr['href'] = $link; if( $smof_data['nofollow_social_links'] ) {
$attr['rel'] = 'nofollow';
} if( $args['icon_color'] ) {
$attr['style'] = sprintf( 'color:%s;', $args['icon_color'] );
} if( strtolower( $this->args['icon_boxed'] ) == 'yes' && 
$args['box_color']
) {
$attr['style'] .= sprintf( 'background-color:%s;border-color:%s;', $args['box_color'], $args['box_color'] );
} if( strtolower( $this->args['icon_boxed'] ) == 'yes' &&
$this->args['icon_boxed_radius'] || $this->args['icon_boxed_radius'] === '0'
) {
if( $this->args['icon_boxed_radius'] == 'round' ) {
$this->args['icon_boxed_radius'] = '50%';
} $attr['style'] .= sprintf( 'border-radius:%s;', $this->args['icon_boxed_radius'] );
} if( strtolower( $this->args['tooltip_placement'] ) != 'none' ) {
$attr['data-placement'] = strtolower( $this->args['tooltip_placement'] );
if( $tooltip == 'google-plus' ) {
$tooltip = 'Google+';
}
$attr['data-title'] = $tooltip;
$attr['data-toggle'] = 'tooltip';
}

$attr['title'] = $tooltip; return $attr; } 才导致图标无法显示,但是我百思不得其解,为什么Facebook能顺利通过判断并输出,Weibo则不行问题:
1:解释一下处理部分, 各各判断代码的功能
2:解释一下为什么在经过判断的时候Weibo被剔除了(猜测,欢迎研究后告知正确问题)
如果对代码有问题,欢迎提出,我会解释。
本人新手,感谢各位大大的帮助,解决下我的问题,不胜感激!