I'm having trouble including an external .php file into my WordPress theme.
WordPress installation URL: mydomainname.com/blog
PHP File URL: mydomainname.com/testing/assets/inc/analytics.php
I'm trying to include this PHP file from within header.php of my WordPress theme.
My line of code looks like this:
<?php include ( site_url() . '/testing/assets/inc/analytics.php' ); ?>
I've also tried variations of PATH
and ABSPATH
but I can't get it to work. Interestingly, when I change the include
to require_once
it breaks the site.
Please help me figure out what exactly I'm doing wrong. Thank you!