dongtong848825 2014-07-18 07:12
浏览 41

wp_head钩子包括文件不工作wordpress

I am having some issue with site I am developing. Let me know you some of the pages are static php pages which are working fine. But the issue is with wordpress pages, I have all css and js files are included from header-required.php file. I am calling this header-required.php file from function file by wp_head hook. here is my code of function.php file:

function hook_javascript()
{
     include('http://'.$_SERVER['HTTP_HOST'].'/inc/header-required.php');
} 
add_action('wp_head','hook_javascript');

And I am calling this function from all wordpress file code wp_head(); here is the code:

while loading, This function is calling properly, but it does not including file header-required.php. If i am including this file from specific wordpress file, Its working. Please help. Thanks..

your specified path is correct. Actully I am calling this file from wordpress and header-required.php file is php file which is outside wordpress directory. example.com contain all static php pages, and inside this directory,I have created one another directory called wrpas, which contains wordpress. This some what confusing because i am using static php pages and wordpress together on one site. Another thing header and footer files are static php pages, which i am using in wordpres.

Thanks!!!

  • 写回答

2条回答 默认 最新

  • dpmrakfbx820320638 2014-07-18 08:04
    关注

    Put that file in theme folder

    Rather than using php include use get_template_part for wordpress

    Use

        <?php get_template_part('header-required'); ?>
    

    For more details

    http://codex.wordpress.org/Function_Reference/get_template_part

    评论

报告相同问题?

悬赏问题

  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题