wp_list_pages outside WP to point elsewhere? (12 posts)

  1. moshu
    Posted 11 years ago #

    I guess it's a stupid title :)
    Here is what I have: using WP to manage a site where there are 6-7 files in the root and the blog in a subdir. No Pages and Page list used in the blog.
    The physical files in the root are basically copies of the theme index and made WP-aware - without the Loop.
    Instead I am using the get-a-post plugin to call the content of Pages created in WP - in this way updating their content later will be easy.
    I can use even the wp_list_pages tag on those files in the root to list the Pages... the only problem is the links (of course) would take the visitor to the blog - as opposed to go to another file in the root. I know I could manually code the list of the files in the menu, but what if they want to add newer files/Pages later?
    Any smart idea about listing the Pages but having them point to the actual files where they appear?

  2. Firas
    Posted 11 years ago #

    How similar are the file names to the page names? You can probably just adjust the function depending on how parallel the page slug is to the physical filename.

    And this scheme is just going to keep getting you into more and more issues.. any particular reason for keeping static files like that?

  3. moshu
    Posted 11 years ago #

    You mean why not hardcode those 6 files in the root? I jsut wanted to be nice with the site owner - making the future update easier. But obviously I am over-complicating it :)
    Do you have a better idea? Thanks!

  4. ringmaster
    Posted 11 years ago #

    You've gone through a lot of trouble to avoid using the default Loop and use separate pages. Can we ask why?

    Can you not accomplish virtually the same thing with the built-in rewrite rules that WP generates?

  5. moshu
    Posted 11 years ago #

    The thing is the owner wants a structure like:
    example.com/whatever... etc.

    and the blog in a subfolder as a separate entity:

    So just using WP with its rewrite rules would be "example.com/hisblog/services"

  6. Firas
    Posted 11 years ago #

    Put your index.php in the site root, rename your wordpress folder, make /hisblog/ a requirement in the post permalink structure.

    My site root is http://firasd.org, my pages are like firasd.org/contact, my wp folder is at http://firasd.org/wp/, and my blog permalinks are http://firasd.org/weblog..

    Here be instructions:

  7. moshu
    Posted 11 years ago #

    That would be too easy :)
    My problem is that the root site's index has to have a totally different content - not the blogindex! Plus, the blog has to have also its own address, accessible directly, not only by a link from the main(=root) index.
    I guess I'd have to hard code all the menu in the root...
    But thanks anyway!

  8. Firas
    Posted 11 years ago #

    Ok, but in the interest of saving you hours of future hair-tearing, may I suggest this:

    Make the directoryindex of your siteroot something else--that of whatever is your different content (call it default.html perhaps)

    Rewrite /hisblog/index.php to /index.php

  9. moshu
    Posted 11 years ago #

    You've lost me here :(
    When somebody goes to example.com they have to see its index, not the blogindex. Maybe I don't really understand what you are suggesting (which is very likely), or maybe I couldn't explain clearly what I wanted to do. Or maybe it's not doable...

  10. Firas
    Posted 11 years ago #

    If you put the wordpress index.php in /, and put lookatme.php there too, you can add this to /.htaccess:

    DirectoryIndex lookatme.php

    Now when someone goes to example.com, it loads lookatme.php as the default page, not index.php. There's nothing special about the filename index.php/index.html/etc, it's just widely configured as the default file to look for.

    The only reason this might be problematic is if the other content you're loading just at example.com *has* to be named index.php.

  11. moshu
    Posted 11 years ago #

    Thanks again for your patience, Firas :)
    I think I am halfway through it. Though I was afraid it will be something that is above me... like the .htaccess rules. I'll try what you suggested.
    The main page in the root doesn't have to be "index" - it just have to loaded by default in example.com; then in its menu I want the Pages listed via the template tag and by clicking them to have example.com/about and example.com/services etc.
    There will also be a link to the blog, which will be at example.com/blogname (not wp!) - more exactly: blognamesubdomain.example.com (but at the moment it uses a redirect to example.com/blogname
    If I get stuck, I'll bug you again :)

  12. moshu
    Posted 11 years ago #

    I should read carefully before posting :)

Topic Closed

This topic has been closed to new replies.

About this Topic