0

I have a standard WordPress functions file. I am including a separate file at the top of my functions.php page, as include 'myfile.php'

The problem I'm having is when I include the above file, the fonts across the entire website seems to change or not get applied. I look in Chrome web tools to see what font is getting applied, and everything looks fine, except that it is not.

When I remove include 'myfile.php' from functions.php, everything is back to normal. It seems to me the google web fonts I'm using in a separate js file is not getting applied, however, I don't seem to be having a js issue overall.

Any ideas to what's going on?

code from 'myfile.php'

<?php
$month          = date('n');

if      ($month == "2" || $month == "3" || $month == "4") {
$elements       = "Temple, Yard Sale, Visitation";
}
else if ($month == "5" || $month == "6" || $month == "7") {
$elements       = "Relic, Passageway, Kiss";
}
else if ($month == "8" || $month == "9" || $month == "10") {
$elements       = "Glaze, Thread, Murmur";
}
else if ($month == "11" || $month == "12" || $month == "1") {
$elements       = "Husk, Echo, Quell";
}

$latestElements = "Glaze, Thread, Murmur";

?>

functions.php code:

I'm including only the first few lines. Line 1, include() "breaks" the site as far as fonts go.

<?php
include( get_template_directory() . '/elements.php' );

function register_my_menus() {
register_nav_menus(
array(
'header-menu' => __('Main Navigation'),
'footer-menu' => __('Secondary Navigation')
)
);
}
add_action( 'init', 'register_my_menus' );




...?>
  • Look for 404 errors in Chrome Dev tools. Sounds like a path problem. – Christina Feb 1 '17 at 21:50
  • This only occurs when I include an external php file to functions.php, other than that, the fonts render just fine. – Marlon Fowler Feb 2 '17 at 1:27
  • Please edit your question and post the relevant code from the included file. Simply including a PHP file should not be a problem. – Dave Romsey Feb 2 '17 at 1:34
  • Code now included – Marlon Fowler Feb 2 '17 at 1:46
  • Does the elements.php file have scripts or css you're calling? Are the paths correct in the html when you view source. Click on them and see that you don't have 404 errors. – Christina Feb 2 '17 at 1:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.