Created
July 25, 2012 13:03
-
-
Save roose/3176066 to your computer and use it in GitHub Desktop.
Change img src
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Этот фильтр меняет ссылку на файл только на морде сайта: | |
function change_image_src($content) { | |
return preg_replace('/src="([^"]+)"/', 'src="http://src.sencha.io/sw/$1"', $content); | |
} | |
add_filter( 'the_content', 'change_image_src' ); | |
//Этот меняет ссылку на файл при сохранении/обновлении поста: | |
function change_image_src($content) { | |
return preg_replace('/src=\\\"([^"]+)\\\"/', 'src="http://src.sencha.io/sw/$1"', $content); | |
} | |
add_filter( 'content_save_pre','change_ima ge_src' ); | |
//Один из этих фильтров нужно вставить в конец файла functions.php из папки темы. | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment