Title: adding .php files to custom page
Last modified: August 20, 2016

---

# adding .php files to custom page

 *  [thehindutimes](https://wordpress.org/support/users/thehindutimes/)
 * (@thehindutimes)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/adding-php-files-to-custom-page/)
 * Hi!
 * I’m building a custom page for my blog that will work as the main page. So I’ve
   added the <?php /* Template Name: something */?> to the top of the file.
 * Can I import the different .php files from my theme folder. Say if I want to 
   use the footer.php on my main page. Can I just add <?php get_footer(); ?> inside
   whatever div tag I want it in?
 * Or is there something more I have to do?

Viewing 15 replies - 1 through 15 (of 22 total)

1 [2](https://wordpress.org/support/topic/adding-php-files-to-custom-page/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/adding-php-files-to-custom-page/page/2/?output_format=md)

 *  [peredur](https://wordpress.org/support/users/peredur/)
 * (@peredur)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/adding-php-files-to-custom-page/#post-2522090)
 * Yes. You can use whatever WordPress PHP functions you like.
 * Cheers
 * PAE
 *  Thread Starter [thehindutimes](https://wordpress.org/support/users/thehindutimes/)
 * (@thehindutimes)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/adding-php-files-to-custom-page/#post-2522131)
 * Ok, that’s good. Then I must be missing something because I can’t see the footer
   when I put <?php get_footer(); ?> in the div footer tag.
 * Any idea of what it can be?
 * Cheers!
 *  [peredur](https://wordpress.org/support/users/peredur/)
 * (@peredur)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/adding-php-files-to-custom-page/#post-2522139)
 * Have you looked at what’s in the other page template files that form a part of
   your theme? The usual structure is something like:
 *     ```
       <?php get_header(); ?>
   
       <!-- Stuff that goes in the page body -->
   
       <?php get_sidebar(); ?>
       <?php get_footer(); ?>
       ```
   
 * The call to `get_sidebar()` is optional, of course, depending on whether the 
   page requires the sidebar or not.
 * HTH
 * PAE
 *  Moderator [Jose Castaneda](https://wordpress.org/support/users/jcastaneda/)
 * (@jcastaneda)
 * THEME COFFEE MONKEY
 * [14 years, 3 months ago](https://wordpress.org/support/topic/adding-php-files-to-custom-page/#post-2522141)
 * Can you elaborate on what you mean that you can’t see the footer?
 *  Thread Starter [thehindutimes](https://wordpress.org/support/users/thehindutimes/)
 * (@thehindutimes)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/adding-php-files-to-custom-page/#post-2522181)
 * yes, I’ve looked in the index.php to see how it’s done in there and from what
   I can see it should be enough with just putting <?php get_footer(); ?> in the
   appropriate place.
 * What I mean with I can’t see the footer is that if I refresh the page in Firefox
   there’s just nothing showing where the footer ought to be.
 *  [shaile](https://wordpress.org/support/users/shaile/)
 * (@shaile)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/adding-php-files-to-custom-page/#post-2522182)
 * you can also try <?php include(‘footer.php’);?>
 *  Moderator [Jose Castaneda](https://wordpress.org/support/users/jcastaneda/)
 * (@jcastaneda)
 * THEME COFFEE MONKEY
 * [14 years, 3 months ago](https://wordpress.org/support/topic/adding-php-files-to-custom-page/#post-2522245)
 * Yeah, you can try using the PHP include method. I know it may sound so simple
   but there is a footer.php file in your theme directory? I know I’ve done that
   before where I forgot to put it in the right folder.
 *  Thread Starter [thehindutimes](https://wordpress.org/support/users/thehindutimes/)
 * (@thehindutimes)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/adding-php-files-to-custom-page/#post-2522251)
 * Yes, I suppose that’s classic 🙂
    I’ve made my static page inside the TwentyEleven
   folder so every php-file for that theme should be available right?
 * And also, I’m using a child theme .css file (child of twentyeleven’s style.css)
   but it doesn’t seem to find the CSS when I change it in wordpress to use my static
   page.
    I get the HTML of the static page but no CSS or JS. Has that happened 
   to anyone?
 *  [peredur](https://wordpress.org/support/users/peredur/)
 * (@peredur)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/adding-php-files-to-custom-page/#post-2522254)
 * Why don’t you put your static page template inside your child theme folder? WordPress
   looks there first. Any files that are new in your child theme should be in the
   child theme folder, as should any template files that exist in your parent theme
   but that you want to edit.
 * The usual procedure is to copy the original file from the parent theme folder
   to the child theme folder and then to edit the child theme version, leaving the
   parent theme version intact.
 * When you create a child theme, nothing in your parent theme should change. This
   is essential when dealing with a default theme like twentyeleven.
 * Cheers
 * PAE
 *  [peredur](https://wordpress.org/support/users/peredur/)
 * (@peredur)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/adding-php-files-to-custom-page/#post-2522255)
    -  On the CSS issue, have you included an [@import](https://wordpress.org/support/users/import/)
      statement in your child theme’s style.css file to include the parent theme’s
      style sheet?
    - A minimal child theme (which is always the starting point when developing 
      a child theme) comprises:
 *  - A folder in wp-content/themes
    - A CSS file in that folder, called style.css, and containing:
    - The mandatory comments at the top of the page
    - An [@import](https://wordpress.org/support/users/import/) statement to import
      the parent theme’s stylesheet
 * Cheers
 * PAE
 *  Thread Starter [thehindutimes](https://wordpress.org/support/users/thehindutimes/)
 * (@thehindutimes)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/adding-php-files-to-custom-page/#post-2522257)
 * ok, I’ve put all my files in my child theme folder and a copy of the original
   footer.
 * I am still not getting any result when I try to include the footer on the page
   tho.
    I’ve tried both <?php get_footer(); ?> and <?php include(“footer.php”);?
   > but nothing happens. I must be missing something else.
 *  [peredur](https://wordpress.org/support/users/peredur/)
 * (@peredur)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/adding-php-files-to-custom-page/#post-2522259)
 * Well, you shouldn’t need a copy of the original footer, unless you intend to 
   change it. Maybe that’s what’s in your mind…
 * When WP uses a child theme, it looks for a stylesheet in the child folder. That’s
   why the child style sheet is mandatory. It then looks for any template files 
   first in the child theme and then in the parent. So any template files that haven’t
   changed can just be left where they are, in the parent.
 * Basically the child theme just contains the differences between the child and
   the parent.
 * So let’s get back to basics:
    - Does your child theme appear in the list of available themes in the Dashboard?
    - Assuming it does, have you successfully activated it, such that it shows up
      in the Dashboard as the active theme?
    - Assuming it does, when you go to Dashboard –> Appearance –> Editor do you 
      see your child theme’s style sheet open in the editor and do you see links
      to all your child theme’s template files in the list on the right?
    - Do the files available in the editor all contain the code you expect?
 * If all that’s OK we can try to move on.
 * Is there no way you can post a link to your site so we can see what’s going on?
 * Cheers
 * PAe
 *  Thread Starter [thehindutimes](https://wordpress.org/support/users/thehindutimes/)
 * (@thehindutimes)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/adding-php-files-to-custom-page/#post-2522260)
 * Yes, all the expected files are listed on the menu to the left in the editor.
   I’ve made a seperate .css file for the Home Page Template that imports the child
   theme. and they’re all in the child theme folder.
 * If I go to settings -> reading and choose static page and my Home Page template
   then it works but there’s no CSS or JS. If I open up Firebug it says that there
   are no css rules applied so for some reason it’s not being read.
 * If I use the default “Your latest post” option in Settings -> Reading them the
   CSS works for the blog. So the child theme is working. It’s only when I try to
   use the Home Page template and it’s corresponding css-file.
 * I’m still just getting started with developing wordpress sites so
    thanks for
   taking the time and helping btw!
 * Cheers!
 *  [peredur](https://wordpress.org/support/users/peredur/)
 * (@peredur)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/adding-php-files-to-custom-page/#post-2522261)
 * It’s not finding your style sheet. You need to check the relative path in your
   child theme’s `@import` statement, although, to be honest I don’t see why you
   need a separate child sheet.
 * If you’ve put code directly into your HTML page to get the special style sheet,
   you need to use an absolute URL or the style sheet will never be found. So in
   your template file you need something like:
 *     ```
       ...
       <link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_directory'); ?>/my_special_styles.css" />
       ...
       ```
   
 * This assumes that your special style sheet is in the same directory as your theme’s
   style sheet. If not, you need to adjust the path.
 * HTH
 * PAE
 *  Thread Starter [thehindutimes](https://wordpress.org/support/users/thehindutimes/)
 * (@thehindutimes)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/adding-php-files-to-custom-page/#post-2522262)
 * So it might be better to just stick with the one child theme css file?

Viewing 15 replies - 1 through 15 (of 22 total)

1 [2](https://wordpress.org/support/topic/adding-php-files-to-custom-page/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/adding-php-files-to-custom-page/page/2/?output_format=md)

The topic ‘adding .php files to custom page’ is closed to new replies.

## Tags

 * [Import](https://wordpress.org/support/topic-tag/import/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * 22 replies
 * 4 participants
 * Last reply from: [peredur](https://wordpress.org/support/users/peredur/)
 * Last activity: [14 years, 3 months ago](https://wordpress.org/support/topic/adding-php-files-to-custom-page/page/2/#post-2522270)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
