我已将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>
无法理解如何在不调用任何php函数(注释样式和脚本标记)的情况下将wp注入页眉和页脚 . 即使我也禁用了JS . 任何帮助高度赞赏 .
编辑:这不是特定的magento . 我将 wp-load.php
包含在一个独立的PHP脚本中,并且wordpress更改输出 . 在 Headers 和正文结束之前添加样式和脚本 .
2 回答
我想你想要WordPress与Magento集成然后你需要使用fishpig扩展名按照这个URL https://fishpig.co.uk/magento/wordpress-integration/
@mysterious你可以在你的functions.php中尝试这个并回到我们身边吗?