• I’d need to combine wp into a different php template framework. So Is there a way to call for example sidebar.php file to work in some part of my page ?! Or fetch my posts to a html page?

Viewing 3 replies - 1 through 3 (of 3 total)
  • You can make your .php files (not the html ones, though!) “WP aware” by putting at the top of the file – before anything else this:
    <?php
    require('./path-to-your-blog/wp-blog-header.php');
    ?>

    After that you can use all the WP functions in those pages.

    Thread Starter mike9393

    (@mike9393)

    Fatal error: Call to undefined function: wp_get_archives() in

    hmmm I’ve tried everything I can. Does WP index file or wp-blog-index etc. have to be in the same folder or something? If I can’t get this to work is there any “feed readers” which could insert my blog posts to my other php page and even the sidebar?

    Where is the file you are trying to display archives on, and (relative to it) where is the blog?
    Probably it’s a matter of wrong path you put in the codeline above.
    And just for the sake of clarity:
    there is no wp-blog-index file and I never mentioned any WP index file.
    If your whatever.php file is in the root of your site and WP is installed in a floder called “myblog” then the above code should be
    require('./myblog/wp-blog-header.php');
    If the whatever.php is in a folder under the root AND your WP install is in another folder under the root, then obviously the path will change:
    require('../myblog/wp-blog-header.php');
    Google for “relative path”.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘using wordpress commands in my php template’ is closed to new replies.