Viewing 5 replies - 1 through 5 (of 5 total)
  • TEMPLATEPATH is the template URL (https://www.domain.com/wp-content/themes/theme) and the period is concatenation, which means that the template URL is added to whatever follows it.

    Thread Starter ronchicago

    (@ronchicago)

    i understand the function and concatenation. it would seem an absolute path would find the header.php but then, again, maybe i don’t understand.

    i get these error codes, i.e., can’t find header2.php

    Warning: main(TEMPLATEPATH/header2.php) [function.main]: failed to open stream: No such file or directory in /home/code/public_html/enter.php on line 18

    Warning: main() [function.include]: Failed opening ‘TEMPLATEPATH/header2.php’ for inclusion (include_path=’.:/usr/php4/lib/php:/usr/local/php4/lib/php’) in /home/code/public_html/enter.php on line 18

    TEMPLATEPATH is a special WordPress function, so it can only be used within WordPress. Try a regular php include instead.

    Thread Starter ronchicago

    (@ronchicago)

    tried it both ways – both in and out of wp – and moved the file back inside wp, though in the wp root and the wp-contents.

    thanks iridiax

    ronchicago,

    Since you’re supplying an absolute path, just use
    <?php include ('https://www.domain.com/wp-content/themes/theme/header2.php'); ?>

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘include templatepath function’ is closed to new replies.