2016-10-22 294 views
2

我試圖將<a href="skype:sitspak?call">放在我的WordPress安裝頁腳中。將協議添加到wordpress

爲了實現這一點,我將skype協議添加到wp_allowed

以下,從functions.php

function wp_allowed_protocols() { 
    static $protocols = array(); 

    if (empty($protocols)) { 
     $protocols = array('http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet', 'mms', 'rtsp', 'svn', 'tel', 'fax', 'xmpp', 'webcal'); 

     /** 
     * Filters the list of protocols allowed in HTML attributes. 
     * 
     * @since 3.0.0 
     * 
     * @param array $protocols Array of allowed protocols e.g. 'http', 'ftp', 'tel', and more. 
     */ 
     $protocols = apply_filters('kses_allowed_protocols', $protocols); 
    } 

    return $protocols; 

我將在下面的代碼的代碼段我的孩子主題的function.php

// 
// Your code goes below 
// 

function ss_allow_skype_protocol($protocols){ 
    array_push($protocols, 'skype'); 
    return $protocols; 
} 
add_filter('kses_allowed_protocols' , 'ss_allow_skype_protocol'); 

但出於某種原因,這並不工作;我怎樣才能成功實現這一目標?

回答

0

你把第一段代碼放到你的functions.php中了嗎?你只需要過濾器調用(第二塊代碼),一切都應該正常工作。

+0

第一件是在wp-included/functions.php – Suleman

+0

第二件是在兒童主題的functions.php – Suleman

+0

我沒有修改核心'functions.php',因爲它不建議這樣做。 – Suleman