I am used to creating websites outside of wordpress just using HTML, CSS and JS. Normally if I want to create a link to a page, about-us.html, I simply add:

<a href="/about-us.html">About Us</a>

I have an HTML based template which I converted to wordpress theme via FTP. If I want to accomplish the same thing am I just supposed to reference about-us.php like:

<a href="/about-us.php">About Us</a>

Where about-us.php is:

 * Template Name: About Us
 * @package WordPress
 * @subpackage Besa
 * @since Besa HTML5 3.0

get_header(); ?>

<?php include('/about.html');?>

<?php get_footer(); ?>

Is this all that is needed? Should I be copy and pasting the HTML instead of using the include statement? Do I have to create a new page in the wordpress editor? Do I have to select a PAge Attribute Template, and if so why?


EDIT: When I try my method I just get an error "Fatal error: Call to undefined function get_header() in /home/besa/public_html/about-us.php on line 10"

3 Answers 3


WordPress doesn't work that way. In WordPress, none of the posts or pages that you visit actually exist anywhere on the disk. The content is grabbed from database and then the template files are filled with them and sent to browser.

In your case, you should create a file name about-us.php instead of about-us.html and then include it in your template by using this:


Now you will be able to create a page from admin panel and use this file as its template.

As for your questions about link... Again you shouldn't directly link to a PHP file, because it simply won't work. If you access a PHP file directly, it doesn't load WordPress's engine when it is loading.

To do so, you should use the slug. Create a page, write down its slug, and then create a dynamic link in your PHP template like this:

<?php echo site_url('/some-path/slug-goes-here'); ?>

The above function with append /some-path/slug-goes-here to your site's URL and output it, which would be your page's link.

  • Okay, I'm still struggling a bit. Step 1: I created a blank php file called about-us.php in my specific theme folder which has only 1 line of code in it - "<?php get_template_part('/wp-content/themes/Besa/about-us.php'); ?>" Step 2: I created a page by going to add page and I called it "About Us" - but I don't see any new template options? Also, by slug do you mean the permalink: "besa.com/about-us" that pops up in the page editor? Jun 30, 2017 at 13:27
  • @MatthewSirkin 1) The path should be relative to your theme's directory. For example, if the file is directly in the theme's folder, the path is simply about-us.php. 2) Your template's name should start with page- if you want WordPress to find it. For example, page-about-us.php, and then you can use get_template_part(...); in this file. 3) Yes, by slug I meant the permalink, but without the besa.com.
    – Johansson
    Jun 30, 2017 at 13:45
  • @MatthewSirkin Also remember this very important note: You can not access any of your PHP files inside your template directly. It will trigger a fatal error. Instead you should use them as templates to create pages in the admin panel.
    – Johansson
    Jun 30, 2017 at 13:49
  • Okay, 1) understood 2) okay so am I creating 2 php files then? One called about-us.php which has the content of what I want to appear - and one called page-about-us.php which includes get_template_part('about-us.php');? I think my mental block lies in not understanding templates or template directories.. Is there a place to read about what these terms mean? 3) understood. Jun 30, 2017 at 14:05
  • 1
    Ah, all is clear now. Thank you. I wish i could upvote the comments to let people know what was helpful, but I guess I need more rep for that. Greatly appreciate your time and effort! Jun 30, 2017 at 15:35

First, create a page from WordPress Admin called "About Us". Then choose the page template from the right sidebar of the "About Us" page under "Page Attributes" section. Then use the following code in any of your template files where you want to create a link to "About Us" page.

<?php echo get_site_url(); ?>/about-us

Note that "about-us" is the page slug



<?php echo get_bloginfo('url').'/about.html'; ?>
  • 2
    Please edit your answer, and add an explanation: why could that solve the problem?
    – fuxia
    Jul 1, 2017 at 11:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.