我在确定图像var的路径时遇到了一个小问题。 这是发生了什么。这是图片标签:
<img src="http://www.xxx.info/wp-content/uploads/http://ecx.images-amazon.com/images/I/51AV8B7CT2L._SL160_.jpg" class="attachment-135x135 wp-post-image" alt="Clean & Sober" title="Clean & Sober">
这就是我希望如何,没有http://www.xxx.info/wp-content/uploads/
:
<img src="http://ecx.images-amazon.com/images/I/51AV8B7CT2L._SL160_.jpg" class="attachment-135x135 wp-post-image" alt="Clean & Sober" title="Clean & Sober">
这是wordpress代码:
<?php $thumb = '';
$width = 135;
$height = 135;
$classtext = '';
$titletext = get_the_title();
$thumbnail = get_thumbnail($width,$height,$classtext,$titletext,$titletext,false,'Entry');
$thumb = $thumbnail["thumb"]; ?>
<?php print_thumbnail($thumb, $thumbnail["use_timthumb"], $titletext, $width, $height, $classtext); ?>
更多相关功能:
/* this function prints thumbnail from Post Thumbnail or Custom field or First post image */
function print_thumbnail($thumbnail = '', $use_timthumb = true, $alttext = '', $width = 100, $height = 100, $class = '', $echoout = true, $forstyle = false, $resize = true, $post='') {
if ( $post == '' ) global $post;
$output = '';
$thumbnail_orig = $thumbnail;
$thumbnail = et_multisite_thumbnail($thumbnail);
$cropPosition = get_post_meta($post->ID, 'etcrop', true) ? get_post_meta($post->ID, 'etcrop', true) : '';
if ($cropPosition <> '') $cropPosition = '&a=' . $cropPosition;
if ($forstyle === false) {
if ($use_timthumb === false) {
$output = $thumbnail_orig;
} else {
$output = '<img src="'.get_bloginfo('template_directory').'/timthumb.php?src='.$thumbnail.'&h='. $height .'&w='. $width .'&zc=1&q=90'.$cropPosition.'"';
if ($class <> '') $output .= " class='$class' ";
$output .= " alt='$alttext' width='$width' height='$height' />";
if (!$resize) $output = $thumbnail;
}
} else {
$output = $thumbnail;
if ($use_timthumb === false) {
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $output, $matches);
$output = $matches[1][0];
} else {
$output = get_bloginfo('template_directory').'/timthumb.php?src='.$output.'&h='.$height.'&w='.$width.'&q=90&zc=1'.$cropPosition;
}
}
if ($echoout) echo $output;
else return $output;
}
这是我在图片代码中返回的$output = $thumbnail_orig;
。
我知道http://www.xxx.info/wp-content/uploads/
应该有一个var
另一个用于http://ecx.images-amazon.com/images/I/51AV8B7CT2L._SL160_.jpg
我想删除uploads
的网站路径。
由于
答案 0 :(得分:0)
我可能错了或误解了这个问题,但我认为在WP中设置路径就像在管理面板中编辑它一样简单,在设置下,不是吗?
DC