【发布时间】:2017-08-05 00:59:54
【问题描述】:
我已将 wordpress 包含在 magento 中,以便通过向 magentos index.php 添加以下行来使用 wordpress 功能。
define('WP_USE_THEMES', false);
require_once MAGENTO_ROOT . '/blog/wp-load.php';
但是这段代码以某种方式在 magento 文件的页眉和页脚中注入了 wordpress wp_head 和 wp_footer 代码。
这是我的 magento 模板文件 (2columns-left.phtml)。
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
</body>
</html>
但输出是
<!DOCTYPE html>
<html lang="en">
<head>
<style type="text/css">
img.wp-smiley,
img.emoji {
display: inline !important;
border: none !important;
box-shadow: none !important;
height: 1em !important;
width: 1em !important;
margin: 0 .07em !important;
vertical-align: -0.1em !important;
background: none !important;
padding: 0 !important;
}
</style>
<style type="text/css">
.mobile-menu {
position: -webkit-sticky;
position: -moz-sticky;
position: -ms-sticky;
position: -o-sticky;
position: sticky;
}
</style>
</head>
<body>
<script type='text/javascript' src='https://SITNAME.com/blog/wp-includes/js/jquery/jquery.js?ver=1.12.4'></script>
<script type='text/javascript' src='https://SITNAME.com/blog/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.4.1'></script>
</body>
</html>
无法理解 wp 如何在不调用任何 php 函数的情况下将 html 注入页眉和页脚(注意样式和脚本标签)。甚至我也禁用了 JS。任何帮助都非常感谢。
编辑:
这不是 magento 特有的。我将wp-load.php 包含在一个独立的 php 脚本中,然后 wordpress 更改输出。在标题和正文结束之前添加样式和脚本。
【问题讨论】:
标签: php wordpress magento magento-1.9