简体   繁体   中英

phpfile include error in wordpress header

i have this code in my home.php-

  <?php

   include('PHPLiveX.php');

 $ajax = new PHPLiveX();

    $ajax->Ajaxify(array("applyJob"));

    get_header();

    ?>

now i am moving this code to my header.php

include('PHPLiveX.php');

$ajax = new PHPLiveX();

$ajax->Ajaxify(array("applyJob"));

so that it will be available for all word-press file. but its giving me blank page(no error). i know that file is including because when i echo some content in the included file it shows in the page.the phplivex.php file contain a class which is used to ajaxify the theme. any guess wats causing the blank page?

You need to use complete real path of that file in-order to include it.

include('FULLPATHOFDIRECTORY/PHPLiveX.php');

FULLPATHOFDIRECTORY = has to be path to that directory which keep this file.

I think that you should use include_once() or require_once() when you call this file in header.php. Hope it helps.

U Go in your theme and in your active theme open function.php And Add this Code.

function.php

function IncludeFileFun(){
    include('PHPLiveX.php');
}

add_action( 'init', 'IncludeFileFun' );

Note : PHPLiveX.php File is include in your active theme folde.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM