Hi, I want to create a new php page to show some custom things. Before writing code in this page, which INCLUDE or REQUIRE i must to insert to use all wordpress funcions and classes?
Hi, I want to create a new php page to show some custom things. Before writing code in this page, which INCLUDE or REQUIRE i must to insert to use all wordpress funcions and classes?
Something like this should work for you:
<?php
require_once '/home/user/public_html/wp-config.php';
require_once '/home/user/public_html/wp-settings.php';
get_header();
// CUSTOM CONTENT GOES HERE
get_sidebar();
get_footer();
?>
You will need to replace the /home/user/public_html/ part with the server path to your WordPress installation.
require_once '/home/user/public_html/wp-config.php';
require_once '/home/user/public_html/wp-settings.php';
Unnecessary.
wp-blog-header.php takes care of both of those.
Whooami,
So, this would be a better solution:
<?php
require_once '/home/user/public_html/wp-blog-header.php';
get_header();
# CUSTOM CONTENT GOES HERE
get_sidebar();
get_footer();
?>This works:
require('./wp-blog-header.php');
wp-blog-header.php takes care of including everything necessary to use WP fucntions outside of WP.
(adjusting the path, obviously)
Thanks a lot.
Tomorrow I'll try your code.
Bye
Hello,
it's my first post here!nice to meet u!
So I had the same question, and I understand your answers.But i have a other question.
I create a new page, for example page2.php I do all the thinks you say,ok with this.
But how can I display the page to browser??
I use permalinks to get post like site-url/month/day/category/post-title or for the pages site-url/page-title. How can display the page2.php which I was create?
Is there any way to get it like site-url/pages/page2 ??
Thank you.
Bad replies, no solution. This should be well documented in the codex, don't reply with crap...
For me isn't working your code. waste time!
This topic has been closed to new replies.