Support » Fixing WordPress » Adding header,footer and side widgets to custom php page

  • Resolved Morsus

    (@morsus)


    I manage to do this with SMF and PHPBB forums but i cant do it with wordpress..I know it could be possible,so anyone can help me out?

    For those who didn’t understand my problem.
    I have an php page that has nothing to do with wordpress files,i want it to have the same header,footer and side widgets..

Viewing 5 replies - 1 through 5 (of 5 total)
  • Using header and footer (and side widgets too i suppose) means two things: you need a mean to include them in your main file and the libraries loaded up in order to call the WP functions correctly. For your page to call the WP function your file needs to remain in the scope of WordPress as far as I know, so you’re very limited in terms of which directory to store them in.

    As far as including the files themselves, you can simply perform a PHP include on them.

    Thread Starter Morsus

    (@morsus)

    I can store that php file anywhere,just tell me witch files i need to include and in witch order.thanks 😀

    It’s not that easy, you’re attempting to pull in the whole WordPress installation in session. I have no idea what files you’d need to include. You’re best bet is to save these files within the WordPress scope so you can call their functions directly.

    Thread Starter Morsus

    (@morsus)

    WordPress scope?

    Thread Starter Morsus

    (@morsus)

    Got it,for anyone who wants to do the same this just add this code on the beginning of your file:

    <?php
    require('wp-load.php');
    get_header();
    ?>

    And this on the end:

    <?php get_footer(); ?>

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Adding header,footer and side widgets to custom php page’ is closed to new replies.