• Resolved behappy

    (@behappy)


    Please goto https://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 !

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter behappy

    (@behappy)

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

    1. It always helps if you type your domain name correctly ??
    https://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.

    Thread Starter behappy

    (@behappy)

    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
    https://wordpress.pastebin.ca/304411

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

    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.

    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.

    ??
    At least I was messing with the line that was causing the problem…

    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…

    Thread Starter behappy

    (@behappy)

    Thanks Kafkaesqui & Moshu!
    It’s working fine !

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘“last post” and “categories” challenge’ is closed to new replies.