1

I want to add specific page to Wordpress template.

for example , I want to add page called "Our Team" , these page contains special php code, and I tried to access to it through www.domain.com/team

but the wordpress redirect the user to 404.php page.

How I can create php page in Wordpress template folder.

Mohammad Diab
  • 258
  • 3
  • 13

3 Answers3

2

The top of your custom php page must contain something like this

/**
 * Template Name: My Custom Page
 */

Then go into Wordpress, create a page (name it whatever you want) and then under Page Attributes change the Template to 'My Custom Page'. This will create the link from your custom page to a Wordpress page that you can naviagate to.

Tuesdave
  • 669
  • 2
  • 8
  • 26
0

you need only create a template for the page you want. In the template file you can insert php code as needed.

1 - First create a php file using the nomenclature "page-" + [My-Name-page], for example: page-our-team.php


2 - In the file header put the following comment to the wordpress recognize the file as a new page template:

<?php /* Template Name: PAGE OUR TEAM */ ?>

3 - Before starting with its fully custom code, test to see if everything is correct.

<?php echo "My happy custom php code";?>


4 - Save your file and go to the administration panel of wordpress. Create a blank page, and select the template you created in the screen right selection list.

5 - Test the page's url in your browser and see if your test worked.


6 - Feel free to ask if you have questions.

0

Creating a new template is good way for you, follow the steps as:

1:Create any new file in your theme and paste the following code at the very top

<?php 

    /** Template Name: Team */
?> 

2: Add your code in this created template and save it with template name [templatename].php so it will be team.php for this example. You can name it any other structure you like as long as it is a php file.

3: Login to your wordpress admin panel, create New Page there, as you already have your code in file so left the content blank.

4: From right hand side, Choose the created template (in this case team.php) and assign to page.

Keep in Mind if you are using thirdparty theme then save your template in child theme.

PHPExpert
  • 945
  • 5
  • 9