PDA

Просмотр полной версии : Проблемы после установки плагина WPML Multilingual CMS



zakbc
09.04.2010, 14:23
После установки плагина возникла проблема при выводе картинок в списке категорий.
В русской версии все нормально(она по умолчанию), в английской не работает. Вывод после просмотра выполнения плагина, поле там где должен быть рисунок предосмотра пустое...
Код запроса вывода рисунка:
<?php echo get_post_image (get_the_id(), '', '', '' .get_bloginfo('template_url') .'/includes/timthumb.php?zc=1&amp;w=50&amp;h=50&amp;src='); ?>
Код функции:
function get_post_image ($post_id=0, $width=0, $height=0, $img_script='') {
global $wpdb;
if($post_id > 0) {

// select the post content from the db

$sql = 'SELECT post_content FROM ' . $wpdb->posts . ' WHERE id = ' . $wpdb->escape($post_id);
$row = $wpdb->get_row($sql);
$the_content = $row->post_content;
if(strlen($the_content)) {

// use regex to find the src of the image

preg_match("/<img src\=('|\")(.*)('|\") .*( |)\/>/", $the_content, $matches);
if(!$matches) {
preg_match("/<img class\=\".*\" title\=\".*\" src\=('|\")(.*)('|\") .*( |)\/>/U", $the_content, $matches);
}
$the_image = '';
$the_image_src = $matches[2];
$frags = preg_split("/(\"|')/", $the_image_src);
if(count($frags)) {
$the_image_src = $frags[0];
}

// if src found, then create a new img tag

if(strlen($the_image_src)) {
if(strlen($img_script)) {

// if the src starts with http/https, then strip out server name

if(preg_match("/^(http(|s):\/\/)/", $the_image_src)) {
$the_image_src = preg_replace("/^(http(|s):\/\/)/", '', $the_image_src);
$frags = split("\/", $the_image_src);
array_shift($frags);
$the_image_src = '/' . join("/", $frags);
}
$the_image = '<img alt="" src="' . $img_script . $the_image_src . '" />';
}
else {
$the_image = '<img alt="" src="' . $the_image_src . '" width="' . $width . '" height="' . $height . '" />';
}
}
return $the_image;
}
}
}
В чем может быть проблема?
Заранее спасибо

228228
08.02.2014, 16:46
Подработка наборщиком текстов на дому. Простая работа. Для кандидатов нет ограничений. Выплаты - за каждый заказ отдельно. Заработки 900-1400 руб в день. Пишите на email: [email protected]