WordPress.org

Forums

Static pages outside of wordpress (8 posts)

  1. nimaha
    Member
    Posted 5 years ago #

    I'm trying create a directory on my site that is updated outside or wordpress. I'm going to create a database for this directory and update the pages separately of wordpress.

    However, I would like it to maintain the same settings all the other pages have through wordpress. For example, the widgets I have for the sidebars would still be desired so I don't have to update in two places. I'd also like it to maintain the connection for functions like bloginfo and other similar items. When I try and set up a page that still calls wordpress files, I inevitably get a fatal error.

    Fatal error: Call to undefined function language_attributes() in **** on line 2.

    Sorry, I'm not that knowledgeable in php and can't find through my research a way to do this. I'm wondering if someone knows how I can maintain separate pages outside of wordpress that still utilize some of WP's functions.

  2. designsimply
    Member
    Posted 5 years ago #

    Did you try including wp-blog-header.php?

    <?php require('./wp-blog-header.php'); ?>

  3. Will Kemp
    Member
    Posted 5 years ago #

    Why don't you do it with a template? You can put what you like in the template file and create a blank page in WP using that template - that way it's part of WP and can use header, sidebar, etc, but have any code you want to produce the main body of the page.

  4. nimaha
    Member
    Posted 5 years ago #

    Thanks for your responses.

    Keeping it with the template would be fine (and preferred) especially because I'd like to keep the comment functionality for some of these pages.

    What I'm finding is that if I create a sub-directory (say 2009 directly under the root directory and outside of wp-content), I get the fatal error.

    I run includes to keep the header the same and actually that works pretty well in cases where it doesn't have a WP function.

    Mostly, I have to keep two different includes because I can't seem to have those functions included. Everything in my sub-directory has to be hard-coded. It breaks on the first called function...<?php language_attributes(); ?>

  5. nimaha
    Member
    Posted 5 years ago #

    Let me clarify why I don't just create these pages in the WP admin section.

    I want to keep a database that turns over each year. 2009 will have all sorts of data and then I'll keep that archived while the active directory becomes 2010 next season and so on year after year.

    If it goes where I want it to, the site becomes much more than just a blog and is also a resource center. The home page will always be the blog, but with much more available to explore.

    That becomes way too much for WP to organize without the use of directories. Simply giving each page a custom name isn't enough.

  6. nimaha
    Member
    Posted 5 years ago #

    Sorry for being a post-aholic. It's not imperative that this stays in the WP template. What I really want to maintain is searchability and comments. I've actually decided to use entirely different sidebars for the directories. Perhaps I just need to utilize a different option for this part of the site.

  7. Will Kemp
    Member
    Posted 5 years ago #

    It sounds like you're approaching this from the wrong direction. You're talking about "hard coding" things in a "sub directory" - which doesn't really make much sense in relation to WordPress.

    There should be no problem with php includes, so long as class and function names in the files you include don't clash with WordPress's includes.

    If you want to use WordPress's comment system, then you're going to have to do it within the WordPress structure.

    I don't understand what you mean by it becoming too much for WP to organize without the use of directories. WordPress is a content management system - directories don't really come into it.

    It sounds like you need to write a plugin that can create the pages dynamically. That's quite straightforward really.

    If you're going to use WordPress in this site, i'd recommend using it properly and fully, otherwise you're likely to end up with a nasty mess that will be very hard to maintain and upgrade.

  8. nimaha
    Member
    Posted 5 years ago #

    Thanks for your feedback. I think I'm starting to see how WordPress organizes now and I'm much more comfortable with what I am doing. You're right, I was headed for a big mess so thanks for helping me reevaluate my direction.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.