How to include a PHP library
-
Dear WordPress comunity,
I am having trouble including a php library. Mainly because of lack of knowledge.
Basically i have a php library file >> example.inc.php
-I uploaded it to the root of the website folderNow i have to include this code onto every page and post:
-<?php require_once(“example.inc.php”); ?>Question: Do I put this above code in the header.php (seems logical because the header is loaded on every page, but maybe totally NOT done)
Then I need to add another code on each and every page and post:
<?php
if (isExampleYes()) {
echo “Example is Yes”;
}
if (!isExampleNo()) {
echo “Example is No”;
}
?>My best guess is again to put it in the header.php… but maybe it just isn’t that simple.
Your thought on this matter are very much appreciated.
Best Regards,
- The topic ‘How to include a PHP library’ is closed to new replies.