2 added 319 characters in body
source | link

As @Milo mentioned in his answer, you can't and shouldn't directly call a template file. It is a security risk, and you will no longer be able to access WordPress's engine, so you can't use functions such as the_permalink.

To include a template part in your home.php or any where you wish, you can use get_template_part():

get_template_part( 'relative/path/to/template' );

Don't include .php. It will be added automatically. So, if your about.php is inside /theme/my-theme/folder/, and your home.php is in /theme/my-theme/, you should use this function the following way:

get_template_part( 'folder/about' );

That will include about.php wherever you use the code. Now you have full access to WordPress inside your about.php and there is no need of any ugly URL.

UPDATE

To add a page, create a blank php file named page-whatever.php. Then add the following to its header:

<?php 
/**
 * This is the template for Pages
 *
 * @package YourPackage
 */

get_header();

get_template_part('path/to/portfolio');

Now, you can see your new page template in the back end, while adding a page (under page template drop-down menu).

As @Milo mentioned in his answer, you can't and shouldn't directly call a template file. It is a security risk, and you will no longer be able to access WordPress's engine, so you can't use functions such as the_permalink.

To include a template part in your home.php or any where you wish, you can use get_template_part():

get_template_part( 'relative/path/to/template' );

Don't include .php. It will be added automatically. So, if your about.php is inside /theme/my-theme/folder/, and your home.php is in /theme/my-theme/, you should use this function the following way:

get_template_part( 'folder/about' );

That will include about.php wherever you use the code. Now you have full access to WordPress inside your about.php and there is no need of any ugly URL.

As @Milo mentioned in his answer, you can't and shouldn't directly call a template file. It is a security risk, and you will no longer be able to access WordPress's engine, so you can't use functions such as the_permalink.

To include a template part in your home.php or any where you wish, you can use get_template_part():

get_template_part( 'relative/path/to/template' );

Don't include .php. It will be added automatically. So, if your about.php is inside /theme/my-theme/folder/, and your home.php is in /theme/my-theme/, you should use this function the following way:

get_template_part( 'folder/about' );

That will include about.php wherever you use the code. Now you have full access to WordPress inside your about.php and there is no need of any ugly URL.

UPDATE

To add a page, create a blank php file named page-whatever.php. Then add the following to its header:

<?php 
/**
 * This is the template for Pages
 *
 * @package YourPackage
 */

get_header();

get_template_part('path/to/portfolio');

Now, you can see your new page template in the back end, while adding a page (under page template drop-down menu).

1
source | link

As @Milo mentioned in his answer, you can't and shouldn't directly call a template file. It is a security risk, and you will no longer be able to access WordPress's engine, so you can't use functions such as the_permalink.

To include a template part in your home.php or any where you wish, you can use get_template_part():

get_template_part( 'relative/path/to/template' );

Don't include .php. It will be added automatically. So, if your about.php is inside /theme/my-theme/folder/, and your home.php is in /theme/my-theme/, you should use this function the following way:

get_template_part( 'folder/about' );

That will include about.php wherever you use the code. Now you have full access to WordPress inside your about.php and there is no need of any ugly URL.