包括自定义位置的页眉和页脚

是否可以将wordpress标头包含在位于文件夹中的php文件中, 例如:wp-content / uploads / custom.php?


#1


你可以利用此文档:将WordPress与你的网站集成

在你的情况下, 你可以创建文件content.php并添加以下代码, 我刚刚在我的网站上尝试了此方法, 它的工作原理是:

<?php 
  $path = $_SERVER['DOCUMENT_ROOT']; // Gets the root directory URL
  $path .= '/domain_dir'; // Appends your WordPress installation URL
  require( dirname($path) . '/wp-blog-header.php'); // Require this to execute get_header();

  get_header(); // Executes header.php
?>

来源:

https://www.srcmini02.com/65512.html

微信公众号
手机浏览(小程序)
0
分享到:
没有账号? 忘记密码?