![](/img/trans.png)
[英]Why can't I remove social icons on mobile version even if I uninstalled WP-Socializer Plugin?
[英]Adding a filter to Super Socializer social login
我正在使用一個名為Super Socializer的插件,該插件允許用戶使用Twitter和Facebook登錄。 我想用HTML文本替換社交登錄圖標。 我是使用WordPress中的過濾器的新手,這種方法對我來說是新的。
該插件具有允許我添加過濾器的代碼:
$customInterface = apply_filters('the_champ_login_interface_filter', '', $theChampLoginOptions, $widget);
我用文本更改圖標的方法是在functions.php中做到這一點:
`add_filter('the_champ_login_interface_filter', 'changeIconsToText');
function changeIconsToText() {
// code to change icons to text
}`
問題是我不知道從這里去哪里。 如何獲取帶有圖標的變量並將其更改為文本? 任何幫助將不勝感激,謝謝!
插件的制造商很快就找到了解決方案,因此我在這里將其發布給其他需要它的人。 在functions.php中,只需創建一個函數,然后應用您的更改,然后添加一個過濾器。
function heateor_ss_custom_social_login_icons( $html, $theChampLoginOptions, $widget ) {
if ( isset( $theChampLoginOptions['providers'] ) && is_array($theChampLoginOptions['providers'] ) && count( $theChampLoginOptions['providers'] ) > 0 ) {
$html = the_champ_login_notifications( $theChampLoginOptions );
if ( ! $widget ) {
$html .= '<div class="the_champ_outer_login_container">';
if ( isset( $theChampLoginOptions['title'] ) && $theChampLoginOptions['title'] != '' ) {
$html .= '<div class="the_champ_social_login_title">' . $theChampLoginOptions['title'] . '</div>';
}
}
$html .= '<div class="the_champ_login_container"><ul class="the_champ_login_ul">';
if ( isset( $theChampLoginOptions['providers'] ) && is_array( $theChampLoginOptions['providers'] ) && count( $theChampLoginOptions['providers'] ) > 0 ) {
foreach ( $theChampLoginOptions['providers'] as $provider ) {
$html .= '<li><i ';
// id
if( $provider == 'google' ) {
$html .= 'id="theChamp' . ucfirst( $provider ) . 'Button" ';
}
// class
$html .= 'class="theChampLogin theChamp' . ucfirst( $provider ) . 'Background theChamp' . ucfirst( $provider ) . 'Login" ';
$html .= 'alt="Login with ';
$html .= ucfirst( $provider );
$html .= '" title="Login with ';
if ( $provider == 'live' ) {
$html .= 'Windows Live';
} else {
$html .= ucfirst( $provider );
}
if ( current_filter() == 'comment_form_top' || current_filter() == 'comment_form_must_log_in_after' ) {
$html .= '" onclick="theChampCommentFormLogin = true; theChampInitiateLogin(this)" >';
} else {
$html .= '" onclick="theChampInitiateLogin(this)" >';
}
$html .= '<ss style="display:block" class="theChampLoginSvg theChamp' . ucfirst( $provider ) . 'LoginSvg"></ss></i></li>';
}
}
$html .= '</ul></div>';
if ( ! $widget ) {
$html .= '</div><div style="clear:both; margin-bottom: 6px"></div>';
}
}
return $html;
}
add_filter( 'the_champ_login_interface_filter', 'heateor_ss_custom_social_login_icons', 10, 3 );
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.