简体   繁体   中英

Wordpress - creating custom pages with php code

I need to add few additional pages to my wordpress site. These pages should not be "part of the site", ie they should not be linked somewhere from the posts and so on.

However, they should have the same header/footer as the rest of the site ( I am using custom theme ). And they should be accessible via url.

The final requirement is, I should be able to code in php.

At the moment, I tried to create a new "Page" in my admin console. And then write some php-code inside. However, all my php code gets commented and since not executed.

I don't think that installing plugins such as Exec-PHP is a good idea, so I am trying to find other solutions.

Any comments/advice/suggestions how to make it?

I would be grateful if you give me some how-to link.

Thank you in advance.

You can use a custom page template in your theme for this and just keep the site empty in the admin panel:

http://codex.wordpress.org/Theme_Development#Custom_Page_Templates

By using Template tag's you can create custom page.

write this code on the top of your php file....

/*

Template Name: Your Template Name

 */  

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM