WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] "last post" and "categories" challenge (9 posts)

  1. behappy
    Member
    Posted 7 years ago #

    Please goto http://crusietaiwan.com/blog

    If I click any "categories" on the right hand side, e.g "Travel Taiwan, Taiwan News,Taiwan Calling cards, Taiwan Hotels, Taiwan Flight, Taiwan Photo"
    and then I click any "last post" on the left hand side,
    it will show "Sorry, no posts matched your criteria"

    However, if I click "categories" Taiwan Visa,
    and then I click any "last post" on the left hand side,
    it is working fine

    Please advise
    Thanks !

  2. behappy
    Member
    Posted 7 years ago #

    Any expert know how to fix this ?
    which template should I need to look into ?

  3. moshu
    Member
    Posted 7 years ago #

    1. It always helps if you type your domain name correctly :)
    http://www.cruisetaiwan.com/blog/

    2. What is the code you are using for those Lates posts? It seems it's using a relative path, so when on a category archive (view) it appends the post ID or title to that URL, which obviously doesn't work.

  4. behappy
    Member
    Posted 7 years ago #

    sorry for the typo.I'm not quite sure if this is the code you're looking for.It's from sidebar.php
    edited, coded pasted
    http://wordpress.pastebin.ca/304411

    My Travel Taiwan blog is http://cruisetaiwan.com/blog

  5. moshu
    Member
    Posted 7 years ago #

    What happens if you add a slash [/] in this line:

    echo "<li><a href='?p=$post->ID'>";
    like this:
    echo "<li><a href='/?p=$post->ID'>";

    WARNING: I am not a coder, so it might break your blog. Make a backup before you mess with the code.

  6. Kafkaesqui

    Posted 7 years ago #

    I'd suggest changing this line from the code above:

    echo "<li><a href='?p=$post->ID'>";

    to:

    echo "<li><a href='" . get_permalink($post->ID) . "'>";

    That'll assure it uses the link to each post based on your Permalink settings.

  7. moshu
    Member
    Posted 7 years ago #

    ;)
    At least I was messing with the line that was causing the problem...

  8. Kafkaesqui

    Posted 7 years ago #

    moshu, your suggestion is the simplest (and least intrusive) one to go with. But I suspect most would probably want the links to display as they've set them.

    Options...

  9. behappy
    Member
    Posted 7 years ago #

    Thanks Kafkaesqui & Moshu!
    It's working fine !

Topic Closed

This topic has been closed to new replies.

About this Topic