How to Include Specific File In WordPress Blog Template

by Hiroshi on November 30, 2008

in Hacks, WordPress

Considering the fact that you have some file placed in your current theme folder, you can call it via following code with or without condition. If you plan to call some file right from root folder of your WordPress blog then just remove template path area of code.

With Condition

<?php
if ( is_front_page() ) { include (TEMPLATEPATH . '/bio.php'); }
 else { include (TEMPLATEPATH . '/subscribe.php'); }
 ?>

Include a Specific File Without Condition

<?php include (TEMPLATEPATH . '/sidebar2.php'); ?>

Include a Specific File by URL

<?php include ('https://www.websiteurl.com/some-file.php'); ?>

Related Posts

Previous post:

Next post: