1

I am new to this and can not find any material how to create new page without admin control panel. I am not programmer, but I created my theme files manually and would like to know how should I create page files and what is the order of creating them. I want to create couple of pages(mypage1, mypage2,...mypage5), insert my custom, static information(about us and so on) and link to each of them from the index.php file. Would this work?

Thank you in advance

1
  • If you don't want to use the admin panel at all, it might be that you don't even need a CMS! Otherwise, great answer posted by André below.
    – Tim Malone
    Apr 19, 2016 at 21:07

1 Answer 1

4

Even if you will keep your content static, you must create the pages through wp-admin. It's the right and easiest way. After that, you have some options of how you will keep your content static:

Page template

You'll create a file into your theme folder with your static content, starting with this piece of code inside PHP tags:

/* Template Name: Enter your template name here */

In wp-admin, create a page and select the template with the name you wrote in the code above

Whenever someone hits your page, wordpress will render the content of the file with the selected template name.

Matching the page slug into the file name

After creating a page in wp-admin, you will have a slug to it. The slug is the part of the URL that points to your page. For example in yousite.com/your-new-page, the 'your-new-page' part is your slug. So, if you create a file called 'page-your-new-page.php', this will be the file rendered by wordpress whenever someone enter in the above URL.

Matching the page ID into the file name

The same way as in slug, after creating a page in wp-admin, you will also have a ID to it. You will found the ID looking in the wp-admin page edit URL. For example: yoursite.com/wp-admin/post.php?post=50&action=edit. Your ID is 50.

In the same way we did with slug, you will create a file into your theme folder called 'page-50.php'. That way, whenever someone access yousite.com/your-new-page, wordpress will identify that it's the page with ID 50 and will render the content of page-50.php

I recommend you to read about the wordpress hierarchy (https://developer.wordpress.org/themes/basics/template-hierarchy/)

Hope it helps. :)

1
  • You're welcome, @yonenaho! Apr 20, 2016 at 14:10

Your Answer

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

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