I have Wordpress and I want to add its header and footer to a different script template file. The easiest way would be just to copy and paste the html code, but then I will loose all the dynamic changes and so on.
Wordpress gives a way to add header and footer outside with this two files included:
<?
require('wp-load.php');
include('wp-content/themes/theme/header.php');
?>
But this shows me redeclared functions error 0 two functions are with the same name, so that is the conflict. Since I really cannot edit functions names I am looking for a different solution.
So I came up with executing the script on side in different file (test.php), and then add pure html to my header (header.html - file with php parsing)
So I made something like this:
<?
ob_start();
require('wp-load.php');
include('wp-content/themes/theme/header.php');
$header_output = ob_get_contents();
ob_get_clean();
?>
I include it to my header.html like this:
<?
include('test.php');
echo($header_output);
?>
But unfortunately it didn't help - still conflict, so it includes not the executed script (html), but still functions...
I have tested test.php like below just to see if it works:
<?
ob_start();
require_once('wp-load.php');
include_once('wp-content/themes/theme/header.php');
$header_output = ob_get_contents();
ob_get_clean();
echo($header_output);
?>
then for test I saved the $header_output to a text file (using fwrite()) - it worked, pure html! So I think that something is wrong with my includes...
Of course I can generate new content of the text file every time and include it to my header.html, but I think that is not effective.
What can I do to make the wp-load.php not be included do my header.html?