2014-11-06 55 views
0

我在WordPress网站上遇到了一个问题: 没有显示作为媒体文件上传的图像。我看到他们有这样的错误网址WordPress网站上的错误媒体文件网址

<a class="thumbLink" href="http:///wp-content/uploads/2014/10/Joseph-Angharad-11.7.2014-271.jpg" rel="prettyPhoto[gallery1]" title=""><i class="icon-search"></i></a> 

我试图上传新的媒体文件,他们得到类似的网址,并没有显示。 在数据库中它似乎没问题。我没有看到这样的网址。 你遇到过这样的问题吗?在哪里寻找解决办法?

据我所知,它发生在删除一个插件(这是无效的)之前。

我通过下面的代码获取图像:

// instantiate the controller 
if (!function_exists("peTheme")) { 
    $peThemeClassName = apply_filters('pe_theme_controller_classname','PeTheme'.PE_THEME_NAME); 

    PeGlobal::$controller =& new $peThemeClassName(); 

    function &peTheme() { 
     return PeGlobal::$controller; 
    } 

    peTheme()->boot(); 

} 

<?php $t =& peTheme(); ?> 

<section class="thumbImage"> 
    <img src="<?php echo $t->image->resizedImgUrl($content->get_origImage(),350,0); ?>" alt="" class="fullwidth"> 
    <div class="thumbTextWrap"> 
     <div class="thumbText"> 
      <a href="<?php echo get_permalink(); ?>"><h3 class="sectionTitle"><?php $content->title(); ?></h3></a> 
    <?php 
     $text = get_the_excerpt(); 
      if (strlen($text) > 40) 
      $text = substr($text, 0, 40) . '...'; 

      echo '<p>' . $text . '</p>'; 
    ?> 

    <?php while ($slide =& $slider->next()): ?> 

    <?php $img = $slide->img; ?> 
    <?php 
     if ($first) { 
    ?> 
    <a class="thumbLink" href="<?php echo $img; ?>" rel="prettyPhoto['<?php $content->slug(); ?>']" title=""><i class="icon-search"></i></a> 
    <?php 
     $first = false; 
     } else { 
    ?> 
    <a href="<?php echo $img; ?>" rel="prettyPhoto['<?php $content->slug(); ?>']" title=""></a> 
    <?php 
     } 

    <?php endwhile; ?> 
     </div> 
    </div> 
</section> 
+0

如果var_dump(site_url());'会发生什么情况。 site_url在'href'属性中缺失。显示你如何获得图像的代码。 – pbaldauf 2014-11-06 15:53:20

+0

我更新了问题,请看看 – 2014-11-06 16:07:12

+0

您错过了代码中的某些内容......什么是'$ t'? '$ t-> image-> resizedImgUrl'从哪里来? – rnevius 2014-11-06 16:25:07

回答

1

这相当愚蠢的我,但我没有禁用插件来检查。 问题出在Parallelize插件中。它已被禁用,并从现在的媒体文件有正确的网址。

+0

这个插件遗憾地没有被更新这么久。它不再工作了! – kevthanewversi 2016-11-29 08:28:13

0

这个职位可能有点过时,但我也有类似的最近一期这样的情况下,它被证明有用的人:

首先,我以前曾通过添加以下到最后改变了WordPress的上传目录WP-config.php文件的

define('UPLOADS', ''.'files'); 

所以我所有的文件都保存在domain.com/files/升级到WordPress的4.5之后,所有的媒体文件具有非常错误的URL,(与一些疯狂的喜欢... /的wp-content /上传/ rootuser/public_html/wp-content/uploads ...)我试着重新安装Wordpress,再次改变目录,禁用插件,然后我发现了几个帖子回合Search & Replace工作一些,但仍然没有运气。

然后我发现这个插件,Upload Url and Path Enabler,并使用了适合我的情况如下设置:

存储文件:files

完整文件网址:http://www.domain.com/files

而变!所有媒体网址神奇更新,所有的工作再次!