【问题标题】:NextGen Gallery WordPress upgrade issue - "Not a valid template" messsageNextGen Gallery WordPress 升级问题 - “不是有效的模板”消息
【发布时间】:2014-04-29 22:16:25
【问题描述】:

刚刚将我的 WordPress 网站中的 NextGen Gallery 从 NextGen 版本 1.6.1 升级到 2.0.59

升级后画廊工作正常,但我用来在我的主页上显示四个缩略图的自定义设置不起作用。

我创建了一个自定义主页模板,该模板将显示每个帖子标题和来自相应画廊的四个相关画廊缩略图。

但是,升级后,我看到的不是四个缩略图,而是“[Not a valid template]”

自定义主页代码为:

<ul>
    <?php
    global $post;
    $myposts = get_posts('numberposts=100&order=ASC&orderby=title&category=3');
    foreach($myposts as $post) :
        setup_postdata($post);
    ?>
        <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?> </a> <?php ngg_excerpt(); ?></li>
    <?php endforeach; ?>
</ul>

我在主题函数中添加了一个自定义函数 ngg_excerpt。升级后该功能依然存在,代码如下:

function ngg_excerpt()
{
    //get the post content
    $content_data = get_the_content();
    //extract shortcode from content
    preg_match("/\[ngg([^}]*)\]/", $content_data ,$matches);
    $results = $matches[1];
    //if shortcode exists in content
    if (!empty($results))
    {
        //extract gallery id from shortcode
        $gallery_id = preg_replace("/[^0-9]/", '', $matches[1]);
        //$template = "gallery-compact.php";
        //make sure that NextGen is loaded
        if (function_exists(nggShowGallery))
        {
            //output gallery, showing only 4 images
            echo nggShowGallery( $gallery_id, "compact", 4 );
        }
    }
}

nggShowGallery 似乎包含在新版本的 NextGen Gallery 中。有没有人知道版本 2.0.59 中可能缺少什么或有什么不同会导致这个“[Not a valid template]”消息?

【问题讨论】:

  • 如果您在将next-generation-plugin 标签贴在您的帖子上之前阅读了有用的弹出式描述,您会意识到它与JavaScript 无关
  • 感谢通知,已应用 nextgen-gallery 标签。

标签: php wordpress nextgen-gallery


【解决方案1】:

通过使用图库>其他选项下的重置选项重置图库设置通常可以解决此问题。

【讨论】:

    【解决方案2】:

    将您的自定义模板复制到 /wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/ngglegacy/view/

    【讨论】:

    • 我在这个网站上工作已经有一段时间了。知道在以前的版本中将自定义模板放在哪里吗?
    【解决方案3】:

    编辑帖子并双击图库。

    在那里,在布局部分,选择没有任何服务器的模板 路径前缀。

    【讨论】:

      猜你喜欢
      • 2014-01-29
      • 1970-01-01
      • 2017-08-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-21
      • 2013-09-04
      • 1970-01-01
      相关资源
      最近更新 更多