PHP Magic Book | Free PHP Scripts, Tutorials and Downloads, PHP AtoZ Reloaded, free php tutorials, free php downloads, php scripts, PHP tips

How to Include Specific File In WordPress Blog Template



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 ('http://www.websiteurl.com/some-file.php'); ?>

Share/Save/Bookmark

Tags: ,
Posted in: Hacks, WordPress
Post's RSS » RSS 2.0
Post's Comments RSS » RSS 2.0

Related Posts


Post a Comment

  Subscribe Via RSS
  Subscribe Via Email


About
PHPMagicBook is created by Hiroshi, an IT enthusiast from Pakistan.

I love blogging, PHP Development & social networking.

Ask me for solution relating to Web Development (PHP, Mysql, JS, jQuery, WP) and get free tutorial or script. I answer every email except spam.

Get Website Updates via Email:
more »

English flagItalian flagKorean flagChinese (Simplified) flagPortuguese flagGerman flagFrench flagSpanish flagJapanese flagArabic flagRussian flagGreek flagDutch flagBulgarian flagCzech flagDanish flagHindi flagPolish flagRumanian flagSwedish flagNorwegian flagFilipino flagIndonesian flagSerbian flagSlovak flagSlovenian flagUkrainian flagVietnamese flag