WordPress.org

Ready to get started?Download WordPress

Forums

Show blog contents out of wp-content directory (2 posts)

  1. pronetsys
    Member
    Posted 8 years ago #

    In my hosting root directory i have the 'blog' directory where wordpress is installed.
    I also have index.php in the root directory, which is my website's index.
    My problem is to make the index.php show contents from the 'blog' directory
    My index.php has a portion of code from the sidebar.php in the 'blog/wp-content/themes/default'
    this part:

  2. <h2>Categories</h2>
      <?php wp_list_cats('sort_column=name&optioncount=1&hierarchical=0'); ?>
  3. It shows up well only when i put my index.php file into the 'blog/wp-content/themes/default' directory
    My need is to have the index.php file in the root directory displaying content from the /blog directory,
    do you know if this is possible? I think I must add some includes and dependencies but don't know
    which, how, or where...

  • moshu
    Member
    Posted 8 years ago #

    Put this at the top of your root index (before everything else!)
    <?php
    require('./path-to-your-blog/wp-blog-header.php');
    ?>

    in this way all the WP functions will work on that page.
    Ask if you have more questions.

  • Topic Closed

    This topic has been closed to new replies.

    About this Topic

    Tags