2016-10-22 118 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

相关问题