【问题标题】:Wordpress shortcode popup includes frontendWordpress 短代码弹出窗口包括前端
【发布时间】:2012-07-06 16:31:03
【问题描述】:

我有一个主题,它有一个用于编辑器模式的注册短代码按钮。 当您单击它时,会打开一个包含不同选项/简码 (popup.php) 的弹出窗口。

一般来说这很好用,但碰巧在某些域上,弹出窗口不显示短代码选项,但它显示了我的主题/网站的前端。

希望有人遇到过类似的问题来帮忙,因为我真的不知道如何解决这个问题。
可能是域的重定向问题???

通过点击按钮打开弹出窗口的代码。

(function() {
tinymce.create('tinymce.plugins.popup', {
    init : function(ed, url) {
        // Register commands
        ed.addCommand('mcepopup', function() {
            ed.windowManager.open({
                file : url + '/popup.php', // file that contains HTML for our modal window
                width : 700 + parseInt(ed.getLang('button.delta_width', 0)), // size of our window
                height : 700 + parseInt(ed.getLang('button.delta_height', 0)), // size of our window
                inline : 1
            }, {
                plugin_url : url
            });
        });

        // Register buttons
        ed.addButton('popup', {title : 'Insert Columns', cmd : 'mcepopup', image: url + '/images/button.png' });
    }

});

// Register plugin
// first parameter is the button ID and must match ID elsewhere
// second parameter must match the first parameter of the tinymce.create() function above
tinymce.PluginManager.add('popup', tinymce.plugins.popup);

})();

【问题讨论】:

    标签: wordpress redirect popup frontend shortcode


    【解决方案1】:

    弹窗会显示主题/站点主页的原因之一是因为请求的 URL 无效。

    从代码中我了解到弹出的 URL 是通过连接变量 url 和“/popup.php”导出的 - 要验证 URL 是否有效,请尝试直接在浏览器中复制导出的 URL。如果主题/站点的主页打开,则很可能 URL 不正确 - 大多数现代站点框架会将用户重定向到主页上不存在的 URL。在后端,您可能会收到 HTTP 404。如果弹出窗口的生成 URL 无效,则验证变量 url 并更正。

    另一个原因可能是 popup.php 页面产生了一些错误(HTTP 500 服务器端错误),并且您的站点配置为将用户重定向到 HTTP 500 上的主页。这可能是由于 popup.php 依赖项不是正确配置。

    请验证您的日志文件并检查是否有任何错误消息

    【讨论】:

      猜你喜欢
      • 2016-03-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多