WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Change index.php? (14 posts)

  1. Anonymous
    Unregistered
    Posted 9 years ago #

    I've done a few quick searches and haven't found what I'm looking for so I apologize if I'm double-posting over a previous thread. What I'm looking to do is place WordPress into another page by way of a simply php-include. I don't want to allow comments and I don't want link or anything else, just the posts. I have a format I'm working on and the templates that WordPress uses would force me to change my layout to fit the standard blog style and that's not what I'm keen on doing.
    I like WordPress well enough and I prefer it because I know that its flexible but how would I go about changing the setup to make it post to, say, news.php instead of index.php? I like my code cheap and easy so I prefer to use .css, .php and header and footer files to make my life simply but I'm having a tough time figuring out how to do this with WordPress (I used to do it with Blogger and then Mt).
    Any help would be greatly appreciated and I do sincerely apologize if this has been answered before.
    --Joshua

  2. Mark (podz)
    Support Maven
    Posted 9 years ago #

    Not sure about the news bit, but for what you initially say, then The Loop is all you need:
    http://www.wiki.wordpress.org/TheLoop

  3. Anonymous
    Unregistered
    Posted 9 years ago #

    Thank you podz, if I'm reading that link right that's the raw content that is being read in the template and what is being processed to show the links and comments and all that jazz, correct?
    As for changing the name, the only solution I can come up with is to uninstall WordPress and reinstall it in a sub-dir and then call up that index.php in my php-include on the main page. Sort of a hassle but might be cleaner in the long-run anyways. Hmm.

  4. Mark (podz)
    Support Maven
    Posted 9 years ago #

    The Loop won't show links, just posts and comments, so just delete the feedback div if that is not required.
    Installing into a separate directory would probably be the way I would do it, yes.

  5. Anonymous
    Unregistered
    Posted 9 years ago #

    The more I think about this the less I think that will solve my problem unless I don't want to be able to access any archives or use the --More-- feature because the system still relies on the main file being index.php and I would have to hack the link structure to tell it to point to the sub-dir from the main page links and that would prove problematic if I tried to situate the archives in the sub-dir.
    Hmm. Curiouser and Curiouser. I figured there should be a way to change the output of index.php to something else and that would solve the problem. :/

  6. Mark (podz)
    Support Maven
    Posted 9 years ago #

    Well the archives are auto-created, and the permalink structure will keep them all tidy.
    If you check Carla's site ( http://www.hauntedpalace.net/jolt/ ) you can see that she has all the wordpress 'engine' in a different directory, and the categories and archives links work fine.
    You would need to alter a path or two, but directions for installing into 2 dirs have been covered here:
    Different directories
    http://wordpress.org/docs/installation/different-address/
    What you want to have seems very achievable using WP, and it's been done before, so feel free to fire away with any issues at all.

  7. Anonymous
    Unregistered
    Posted 9 years ago #

    Ok. I've deleted WordPress and will try and new install in a sub-dir (it'll be cleaner that way even if this doesn't work) and try to use the above examples as a guideline but the problem seems to be the same... hmm.. let me see if I can think this out while I type (it helps me figure problems out, sorry).
    If I do as the different-address link suggests and rename the file to, say, new.php and call that into my page via the php-include then the links will still go to the sub-dir and I'd have to reformat everything there in the same fashion. I could try to use WordPress to call up my header, footer, stylesheet and ender files instead of the my page calling up the blog information that WordPress outputs... but then I couldn't use the basic index?new.php formula for the rest of the site because the index.php is now WordPress's index and not just a php-include page calling forth whatever data is required by any given link in question.
    Example;
    My index.php file would be the following;
    code
    <HTML>
    <HEAD>
    <? include('header.php'); ?>
    <?php
    $id=basename($id);
    if(!$id)
    include("new.php");
    else
    include($id);
    ?>
    <? include('footer.php'); ?>
    code
    new.php would contain the basic loop information required to display the posts and comments while the header and footer would define the site in general and allow me greater flexibility in uniformity.
    Perhaps I'm making this more complex then it needs to be...

  8. redneck
    Member
    Posted 9 years ago #

    It sounds like you are trying to do what I did. I have a corporate site and I wanted to include WordPress as a sort of news ticker.
    So instead of somehow attempting to include WordPress in the main site system, I simply installed WordPress in a subdirectory ('news') and wrapped my main site look and feel around it.
    I used the Trident three-column layout for this.
    I describe what I did in more detail in this thread.

  9. gahazzah
    Member
    Posted 9 years ago #

    redneck -
    Danke. That's pretty much what I'm shooting for (premise wise) with the content. I've been trying to wrap my head around for a few hours now but with your help from that other thread I reckon it shouldn't be too hard to finish. Somehow it's always the things that are easy in the long run that stump me, go figure.

  10. gahazzah
    Member
    Posted 9 years ago #

    Ok. I'm lost again. Sorry folks, my brain is futzing right now.
    I can see how I can easily make WordPress look like the rest of my site but I don't see how I can do it while preserving the php-include structure of my links. When somebody clicks a link it goes to "index?link.php" which allows my standard index file to load and that file pulls up my header, footer and content files (as stated above).
    What I need is for WordPress to output my content as anything other than index.php because I don't want to have to build my site around WordPress, I want WordPress to work around my site. Does that make sense?

  11. gahazzah
    Member
    Posted 9 years ago #

    Ok. The Sub-dir trick did the basic gist of what I wanted. Now I just have to get the css to listen to me. Thanks folks for your help.

  12. redneck
    Member
    Posted 9 years ago #

    gahazzah,
    Are you still having trouble with the links after using a subdirectory? That should do the trick.
    I would expect that hacking the code (wherever it is) to get your links to work however you want them to should not be a problem, either.

  13. gahazzah
    Member
    Posted 9 years ago #

    The problem is that I want to do too much, really.
    I figured out how to make it work and I thank you for your help because that other thread made me realize what I was doing wrong. Once I made it work and got the results I wanted (after too much time futzing with my css code) I realized I don't want to have to do that all over again should I decide to put another blog on a different part of my site.
    While I'm not going to rule WordPress out I am going to check out a few other bits of software that my host provides (which is how I learned of WordPress) and then design my entire site again before I worry about the blog part of it.
    Seriously though, thank you for your help.

  14. gahazzah
    Member
    Posted 9 years ago #

    I figured out what my problem was. I was so caught up in the direction to move my index.php file from my /wp directory that I didn't even think to just call it forward from that directory and not replace my php-include based index file.
    podz & redneck, thank you both and I wish I had only been able to wrap my head around this stupid trivial issue sooner because I'm nearly out of coffee (yeah, like that'll ever happen).

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.