0
我有加密功能的內容:功能的add_filter
function rewrite_text($article, $case_sensitive=false) {
$workwith=$article;
*(hide line code for copyright)....(hide line code for copyright)*
$codul='<script type="text/javascript">
document.write(String.fromCharCode('.$numbers.'));
</script>';
$workwith=$codul;
}
return $workwith;
}
add_filter('the_content', 'rewrite_text', 100);
在我的wordpress主題(deTube wordpress主題)有作秀YouTube播放器的功能(在THEME_NAME/functions.php中):
function dp_video($post_id, $autoplay = false) {
$file = get_post_meta($post_id, 'dp_video_file', true);
$file = !empty($file) ? explode("\n", $file) : array();
$url = trim(get_post_meta($post_id, 'dp_video_url', true));
$code = trim(get_post_meta($post_id, 'dp_video_code', true));
if(!empty($code)) {
$code = do_shortcode($code);
if(function_exists('jwplayer_tag_callback'))
$code = jwplayer_tag_callback($code);
$code = extend_video_html($code, $autoplay);
echo '<div class="video-wrap">'.$code.'</div>';
} elseif(!empty($url)) {
$youtube_id = getYouTubeIdFromURL($url);
$video = "<div class=\"video-wrap\"><embed src=\"http://www.youtube.com/v/".$youtube_id."?modestbranding=1&version=3&hl=vi_VN&rel=0&autoplay=1&showsearch=0&iv_load_policy=3&theme=light\" type=\"application/x-shockwave-flash\" allowFullScreen=\"true\" allowScriptAccess=\"always\" width=\"100%\" height=\"100%\"/></div>";
echo $video;
我想通過函數的add_filter到dp_video加密Youtube鏈接(YouTube播放器代碼),使用:
add_filter('dp_video', 'rewrite_text', 100);
但它不工作! 你能幫我添加過濾器的dp_video函數嗎? 非常感謝!