Title: Calling WordPress PHP calls breaks template
Last modified: August 21, 2016

---

# Calling WordPress PHP calls breaks template

 *  Resolved [Snaacky](https://wordpress.org/support/users/snaacky/)
 * (@snaacky)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/calling-wordpress-php-calls-breaks-template/)
 * For some odd reason, each time I try a call from WordPress Codex in header.php(
   example below), the whole template breaks. What would cause such a thing? It 
   literally is disallowing me from using any PHP WordPress calls on my header.php
 * Example:
    `<?php $blog_title = get_bloginfo(); ?>`
 * When I put that in the header and I view the index page’s source code in Chrome,
   the only thing that appears is the header code. The index and footer code suddenly
   disappear. Remove any form of WP PHP code, and it all returns back to normal?

Viewing 8 replies - 1 through 8 (of 8 total)

 *  [Frumph](https://wordpress.org/support/users/frumph/)
 * (@frumph)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/calling-wordpress-php-calls-breaks-template/#post-3679688)
 * Need more context, it could be something in the position you placed the code.
   For example if you added the <?php in a section that already had <?php marker
   enabled, it would do that.
 * Also it depends on the fatal error. If you could give us that fatal error – which
   can be found on your hostings php error log or on the screen, contact your hosting
   on setting up an error log if you don’t have one.
 *  Thread Starter [Snaacky](https://wordpress.org/support/users/snaacky/)
 * (@snaacky)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/calling-wordpress-php-calls-breaks-template/#post-3679690)
 * Error log:
    `[Sun Apr 21 03:00:42 2013] [error] [client xxxxxxxx] PHP Fatal error:
   Call to undefined function get_bloginfo() in /var/www/html/leakcraft.com/news/
   wp-content/themes/leakcraft/header.php on line 45, referer: http://leakcraft.
   com/offline`
 * And here is my code for header.php.
 *     ```
       <!DOCTYPE html>
       <html>
           <head>
               <meta charset="utf-8">
               <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
               <title>LeakCraft</title>
               <meta name="description" content="">
               <meta name="viewport" content="width=device-width">
   
               <link rel="stylesheet" href="/css/bootstrap.min.css">
               <link rel="stylesheet" href="/css/font-awesome.css">
               <link rel="stylesheet" href="/css/just-vector.css">
               <link rel="stylesheet" href="/css/style.css">
               <!--[if lt IE 9]>
                   <link rel="stylesheet" href="css/font-awesome-ie7.css">
                   <script src="js/html5-3.6-respond-1.1.0.min.js"></script>
               <![endif]-->
           </head>
           <body>
   
               <div class="navbar navbar-inverse navbar-fixed-top">
                   <div class="navbar-inner">
                       <div class="container">
                           <a class="brand" href="/">LeakCraft</a>
                           <div class="nav-collapse collapse">
                               <ul class="nav">
                                   <li><a href="/">Home</a></li>
                                   <li><a href="/bans">Bans</a></li>
                                   <li><a href="/map">Map</a></li>
                                   <li><a href="/news/">News</a></li>
                                   <li><a href="/rules">Rules</a></li>
                                   <li class="active"><a href="/staff">Staff</a></li>
                                   <li><a href="http://www.twitter.com/leakcraft">Twitter</a></li>
                                   <li><a href="/upgrade">Upgrade</a></li>
                                   <li><a href="/vote">Vote</a></li>
   
                               </ul>
                           </div><!--/.nav-collapse -->
                       </div>
                   </div>
                   <div class="drop">
                   <div class="sub-navbar">
                       <div class="container">
                           <p><i class="icon icon-user"></i><?php $blog_title = get_bloginfo(); ?></p>
                       </div>
                   </div>
               </div>
       </div>
       ```
   
 * Any ideas?
 * EDIT: For the record, anywhere I put the code it still breaks.
 *  [Frumph](https://wordpress.org/support/users/frumph/)
 * (@frumph)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/calling-wordpress-php-calls-breaks-template/#post-3679693)
 * beyond the fact that $blog_title doesn’t echo out so it’s really just a container
   at this point..
 * Weird though, that’s the only php in the header.php file completely..
 * How is the header.php file being called ? ^ the header.php above is completely
   against the coding practices for WordPress, just curious that it might be also
   how you’re calling the header.php
 *  Thread Starter [Snaacky](https://wordpress.org/support/users/snaacky/)
 * (@snaacky)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/calling-wordpress-php-calls-breaks-template/#post-3679694)
 * It’s being called in index.php via `<?php get_header(); ?>`. Also, the PHP doesn’t
   work regardless. For example if I use `<?php $blog_title = get_bloginfo('name');?
   >`, it still won’t work properly.
 * Also, what do you mean by it’s against the coding practices? If it provides any
   more knowledge, I run the CSS out of my main directory because the only thing
   we use WordPress for is a news blog. So we share the CSS because having duplicated
   CSS would be pointless and we’d have to push out two file updates for each small
   CSS update.
 * The rest of my site is ran off of PHP files (non-WordPress).
 * However since this is on a WordPress header, WordPress functions should function
   properly? I’m not sure why they’re not.
 *  [Frumph](https://wordpress.org/support/users/frumph/)
 * (@frumph)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/calling-wordpress-php-calls-breaks-template/#post-3679706)
 * So I take it since your style.css file is in /css/style.css which means relative
   to the root and not inside the theme directory itself you setup some code that
   looks at that directory as a theme directory?
 * .. Things are relative ya know, especially paths to template files.
 *     ```
       <link rel="stylesheet" href="/css/style.css">
       ```
   
 * If that is off your root installation location and not inside wp-content/themes/
   leakcraft/ .. I seriously can see why you are having issues.
 * Your theme needs to be reworked and made proper coding starting at the ground
   up.
 * [http://codex.wordpress.org/Theme_Development#Anatomy_of_a_Theme](http://codex.wordpress.org/Theme_Development#Anatomy_of_a_Theme)
 * [http://leakcraft.com/wp-content/themes/leakcraft/style.css](http://leakcraft.com/wp-content/themes/leakcraft/style.css)
   does not exist, which is where the themes section references what theme this 
   is. How did you get appearance -> themes to recognize that it’s a viable theme
   to use?
 * Did you change it with ?
 * [http://codex.wordpress.org/Editing_wp-config.php#Moving_themes_folder](http://codex.wordpress.org/Editing_wp-config.php#Moving_themes_folder)
 *  Thread Starter [Snaacky](https://wordpress.org/support/users/snaacky/)
 * (@snaacky)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/calling-wordpress-php-calls-breaks-template/#post-3679838)
 * Alright, so I started working on putting the files that build up my template 
   into the main folder. However the PHP code still doesn’t work properly on WordPress.
 * The problem with this is that I use Twitter Bootstrap for the foundation of my
   website. I cannot use `<link rel="stylesheet" href="<?php get_template_directory();?
   >/css/bootstrap.min.css">` to call bootstrap. My templates PHP is still broken,
   even after moving my source files into my WordPress template directory.
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/calling-wordpress-php-calls-breaks-template/#post-3679840)
 * > I run the CSS out of my main directory because the only thing we use WordPress
   > for is a news blog.
 * possibly review [http://codex.wordpress.org/Integrating_WordPress_with_Your_Website](http://codex.wordpress.org/Integrating_WordPress_with_Your_Website)
 *  Thread Starter [Snaacky](https://wordpress.org/support/users/snaacky/)
 * (@snaacky)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/calling-wordpress-php-calls-breaks-template/#post-3679841)
 * I’m not trying to intergrate WordPress on to the rest of my PHP pages. I’m saying
   that the PHP page that WordPress uses for the header (header.php) located at /
   wp-content/themes/leakcraft/header.php is not using WordPress PHP. It shouldn’t
   need the include since it’s a WordPress template in the WordPress directory, 
   should it?

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Calling WordPress PHP calls breaks template’ is closed to new replies.

 * 8 replies
 * 3 participants
 * Last reply from: [Snaacky](https://wordpress.org/support/users/snaacky/)
 * Last activity: [13 years, 1 month ago](https://wordpress.org/support/topic/calling-wordpress-php-calls-breaks-template/#post-3679841)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
