WordPress.org

Ready to get started?Download WordPress

Forums

links to previous posts don't work (4 posts)

  1. kristie
    Member
    Posted 8 years ago #

    I am designing a web site using Word Press 2.0.1 and a custom template : http://weirdmirror.org/main/

    My friend has her site hosted on Yahoo! so I have NO access to the .htaccess file.

    If you try to navigate the blog you can see that when you click on the title of any post, it goes to the correct permalink, however, the content is that of the latest post. In other words, when you click "Hello World!" it takes you to the correct permalink, but the content is that of "test post 4."

    There are no problems with the permalinks for Pages.

    It does not seem to be a permalink problem, as when I switch to the default the same thing happens.

    This does not seem to be a problem when using the default or classic template (or any other), so I'm sure it must be something that I'm doing wrong in the custom template (I copied and pasted most of the code from another template that works fine).

    Can anyone help me work the bugs out of this? Has anyone else had this issue? I haven't found much in the forums to help me.

    Thanks for any advice you can offer.

  2. Chris_K
    Member
    Posted 8 years ago #

    Personally, I'd start by looking real hard at the code in single.php for that theme. Gotta have some logic issues in there (imho).

  3. kristie
    Member
    Posted 8 years ago #

    Okay, so I figured out it had something to do with listing the recent posts in the sidebar. I took that bit of code out and the links work 100% fine.

    What a huge relief!

    This is what led me in the right direction:
    http://codex.wordpress.org/The_Loop_in_Action

    There's a bit that says if you forget to end your "while" statement it will only show the last post. I looked all over for stray "ends", and found it after the call for recent posts.

  4. kristie
    Member
    Posted 8 years ago #

    Okay, just to clarify for any future users who may have this problem:

    If you want to put a list of recent posts using the "get_posts" tag within your sidebar, then your sidebar MUST occur AFTER your main blog content area in your PHP document. In other words, get header, then the post data, then get sidebar, then get footer. For some reason if the sidebar is called BEFORE the blog content, it interferes with the way links normally work. I always wondered why all public themes put the sidebar so far down on the page, right before the footer. Now I see that there is a good reason for it.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags