Forums

Letting a Single page know what Category led to it (3 posts)

  1. tylerawalters
    Member
    Posted 2 years ago #

    Short Version: I want to be able to tell single.php which archive page sent the user to it.

    Long Version:
    I have posts that have multiple categories. So, perhaps my "All Things Orange" post belongs to the "Colors" category and the "Fruits" category.

    If the user comes to the single "All Things Orange" page from one of the category archive pages, I want to be able to give the user a list of other similar posts based on the category. So, if the user came from the "Fruits" category page, I want to be able to produce a list of posts in the "Fruits" category, and not posts from the "Colors" category.

    I thought this would be simple, but despite all my Google kung-fu, I can't figure it out. Any ideas?

    Thanks in advance for any help you might give.

  2. MichaelH
    Volunteer
    Posted 2 years ago #

    Might look at the plugin http://wordpress.org/extend/plugins/breadcrumb-navxt/ and how it figures that out.

  3. tylerawalters
    Member
    Posted 2 years ago #

    Thanks for pointing out that plugin, Michael, it'll be extremely useful in a few weeks :)

    Unfortunately, though, it doesn't seem to solve the problem, because it doesn't seem to doesn't always give the correct URL in the breadcrumb trail (I've noted this on the plugin author's site).

    Looking at things more and more, it seems that it's a larger problem than I initially thought, in that it seems that WordPress doesn't seem to care about what category leads to a single post, as long as the correct post is displayed. Using my examples in my first post, this is what I'm seeing in my URLs:

    From Colors, I click on the post name and I go to this URL: .../fruits/all_things_orange/

    From Fruits, I click on the post name, and I go to this URL: .../fruits/all_things_orange/

    You'll note that the URLs are identical. It displays the correct post, but the URLs are potentially confusing. I don't particularly care about the URLs at the moment, but I think this is related to my initial question.

    Thanks in advance to anyone with any ideas.

Topic Closed

This topic has been closed to new replies.

About this Topic