Title: where i put an include ??
Last modified: August 18, 2016

---

# where i put an include ??

 *  [Marcomail](https://wordpress.org/support/users/marcomail/)
 * (@marcomail)
 * [19 years, 11 months ago](https://wordpress.org/support/topic/where-i-put-an-include/)
 * I have a php include in the header
    <?php include(‘include.php’); ?>
 * but when i put it i receive a lot of error from wordpress and all the function
   don’t work.
 * where i put it ?
 * The include connect to the db, it’s acsript fro tracking people…is this the problem?

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

 *  [maerk](https://wordpress.org/support/users/maerk/)
 * (@maerk)
 * [19 years, 11 months ago](https://wordpress.org/support/topic/where-i-put-an-include/#post-395211)
 * Could you post the code for the header.php file?
 *  Thread Starter [Marcomail](https://wordpress.org/support/users/marcomail/)
 * (@marcomail)
 * [19 years, 11 months ago](https://wordpress.org/support/topic/where-i-put-an-include/#post-395213)
 * it’s strange…i put in the header the include and ond’t work…i put the same in
   the index.php of template and it works
 * <? include(‘./tts/in.php’); ?>
 * why ?
 * This is the header.php
 * <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “[http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”&gt](http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”&gt);
   
   <html xmlns=”[http://www.w3.org/1999/xhtml”&gt](http://www.w3.org/1999/xhtml”&gt);
 * <head profile=”[http://gmpg.org/xfn/11″&gt](http://gmpg.org/xfn/11″&gt);
    <meta
   http-equiv=”Content-Type” content=”<?php bloginfo(‘html_type’); ?>; charset=<?
   php bloginfo(‘charset’); ?>” />
 *  <title><?php bloginfo(‘name’); ?><?php wp_title(); ?></title>
 *  <meta name=”generator” content=”WordPress <?php bloginfo(‘version’); ?>” /> 
   <!– leave this for stats please –>
 *  <style type=”text/css” media=”screen”>
    [@import](https://wordpress.org/support/users/import/)
   url( <?php bloginfo(‘stylesheet_url’); ?> ); </style>
 *  <link rel=”alternate” type=”application/rss+xml” title=”RSS 2.0″ href=”<?php
   bloginfo(‘rss2_url’); ?>” />
    <link rel=”alternate” type=”text/xml” title=”RSS.
   92″ href=”<?php bloginfo(‘rss_url’); ?>” /> <link rel=”alternate” type=”application/
   atom+xml” title=”Atom 0.3″ href=”<?php bloginfo(‘atom_url’); ?>” />
 *  <link rel=”pingback” href=”<?php bloginfo(‘pingback_url’); ?>” />
    <?php wp_get_archives(‘
   type=monthly&format=link’); ?> <?php //comments_popup_script(); // off by default?
   > <?php wp_head(); ?>
 * </head>
 * <body>
 * <div id=”main” >
 * <div id=”containerleft”>
 * <div id=”logon”></div>
 * <div id=”body”>
 * <?php get_sidebar(); ?>
 * <div id=”box”>
    -  <?php wp_list_cats(‘sort_column=id&optioncount=1&exclude=6’); ?>
 * </div>
 * <div id=”content”>
    <!– end header –>
 *  [maerk](https://wordpress.org/support/users/maerk/)
 * (@maerk)
 * [19 years, 11 months ago](https://wordpress.org/support/topic/where-i-put-an-include/#post-395221)
 * What does include.php do?
 * You mention it connects to the DB, what does it do with that connection?
 *  [maerk](https://wordpress.org/support/users/maerk/)
 * (@maerk)
 * [19 years, 11 months ago](https://wordpress.org/support/topic/where-i-put-an-include/#post-395223)
 * Oh, I just read it tracks people. If it doesn’t actually generate any output 
   for the browser, index.php is probably the best place to put it!
 *  Thread Starter [Marcomail](https://wordpress.org/support/users/marcomail/)
 * (@marcomail)
 * [19 years, 11 months ago](https://wordpress.org/support/topic/where-i-put-an-include/#post-395227)
 * But it’s not the same ? I don’t understand beacuse it doesn’t work on header.
   this is the code of include:
 * [long code removed – always post long code to a pastebin service]
 *  [maerk](https://wordpress.org/support/users/maerk/)
 * (@maerk)
 * [19 years, 11 months ago](https://wordpress.org/support/topic/where-i-put-an-include/#post-395252)
 * I’m not really sure, I’ve noticed that sometimes things don’t work when I put
   them in header. I have a hunch that it’s because index.php is the “main page”,
   and header.php gets included into it — but somehow has “lower privileges”.
 * I’m not entirely sure of the mechanics, though.
 *  Thread Starter [Marcomail](https://wordpress.org/support/users/marcomail/)
 * (@marcomail)
 * [19 years, 11 months ago](https://wordpress.org/support/topic/where-i-put-an-include/#post-395256)
 * with the include i ahve some trouble..for example.
 * In the index.php if i put the include before this i can’t show the rating
 * <?php if(function_exists(‘the_ratings’)) { the_ratings(); } ?>
 * If i put the include at the bottom of the index.php rating is showed…why there
   are all this conflict ?
 *  Thread Starter [Marcomail](https://wordpress.org/support/users/marcomail/)
 * (@marcomail)
 * [19 years, 11 months ago](https://wordpress.org/support/topic/where-i-put-an-include/#post-395380)
 * other ideas ?
 *  [maerk](https://wordpress.org/support/users/maerk/)
 * (@maerk)
 * [19 years, 11 months ago](https://wordpress.org/support/topic/where-i-put-an-include/#post-395410)
 * Is there a particular problem with putting your include at the bottom of index.
   php?
 * If it works, what’s the problem?
 *  Thread Starter [Marcomail](https://wordpress.org/support/users/marcomail/)
 * (@marcomail)
 * [19 years, 11 months ago](https://wordpress.org/support/topic/where-i-put-an-include/#post-395442)
 * It works but for me it’s not the best place, yesterday for example i have receive
   another error…i have add the include in wp-blog-header.php and it works.
 * Which is the best place to put it, now i have put it at the top…but i can include
   better ?:
 * <?php
    include (“in.php”); ?> <?php
 * if (! isset($wp_did_header)):
    if ( !file_exists( dirname(__FILE__) . ‘/wp-config.
   php’) ) { if ( strstr( $_SERVER[‘PHP_SELF’], ‘wp-admin’) ) $path = ”; else $path
   = ‘wp-admin/’; die(“There doesn’t seem to be a `wp-config.php` file. I need this
   before we can get started. Need more help? [We got it](http://wordpress.org/docs/faq/#wp-config).
   You can [create a `wp-config.php` file through a web interface](https://wordpress.org/support/topic/where-i-put-an-include/{$path}setup-config.php?output_format=md),
   but this doesn’t work for all server setups. The safest way is to manually create
   the file.”); }
 * $wp_did_header = true;
 * require_once( dirname(__FILE__) . ‘/wp-config.php’);
 * wp();
    gzip_compression();
 * require_once(ABSPATH . WPINC . ‘/template-loader.php’);
 * endif;
 * ?>
 *  [maerk](https://wordpress.org/support/users/maerk/)
 * (@maerk)
 * [19 years, 11 months ago](https://wordpress.org/support/topic/where-i-put-an-include/#post-395443)
 * I’m not really sure, to be honest. You might try putting it in index.php — the
   one that lies in the root directory. Eg, if your blog was at example.com/blog,
   put it in example.com/blog/index.php.

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

The topic ‘where i put an include ??’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 11 replies
 * 2 participants
 * Last reply from: [maerk](https://wordpress.org/support/users/maerk/)
 * Last activity: [19 years, 11 months ago](https://wordpress.org/support/topic/where-i-put-an-include/#post-395443)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
