• 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?

Viewing 7 replies - 1 through 7 (of 7 total)
  • 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)

    Thread Starter golber

    (@golber)

    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!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Create new php page: which INCLUDE and REQUIRE to do?’ is closed to new replies.