WordPress.org

Ready to get started?Download WordPress

Forums

Smarter Navigation
Assigning more than one category to posts breaks plugin (2 posts)

  1. Sunny_Balanga
    Member
    Posted 3 years ago #

    Hey All,

    Not sure where I've gone wrong, but if I assign a post to 2 categories, namely "A" and "B", then when I access the post from category "A", I get previous/next links to posts in category "B", when I actually expect to see previous/next links to posts in category "A" only.

    I use a custom "child theme" under the "TwentyTen" theme (WP v3.0.4 and Smarter-Navigation v1.2.1.)

    For each category I have a page to display all its posts using:

    <?php query_posts('cat=catID'); ?>

    This is true for the "HOME" page as well, which is set to display the "ARTICLES" category, to which ALL posts would belong.

    In fact, in my layout I would like each post to belong to 2 categories: 1) A "SPECIFIC-TOPIC" category, 2) The "ARTICLES" category, which ideally, would display ALL posts on the "HOME" page.

    I currently have only one post that belongs to more than one category: http://www.sunnybalanga.com/2011/01/14/my-new-listen-to-all-day-tune/

    This post belongs to both the "MUSIC" and "ARTICLES" category.

    If you access it via the "MUSIC" page/category, you should only see previous/next links to other posts in the "MUSIC" page/category, and If you access it via the "HOME" page, you should see previous/next links to posts in the "ARTICLES" category.

    However, when you access this post from the "MUSIC" category/page, the previous/next links displayed belong to the "ARTICLES" category instead of the "MUSIC" category.

    I have read all the posts in this forum. It appears the plugin should be doing things exactly the way I want, but it isn't, and I can't figure out why.

    In single.php I have:

    <?php previous_post_smart( '%link', '<span class="meta-nav">' . _x( '←', 'Previous post link', 'twentyten' ) . '</span> %title', 'TRUE' ); ?>
    <?php next_post_smart( '%link', '%title <span class="meta-nav">' . _x( '→', 'Next post link', 'twentyten' ) . '</span>', 'TRUE' ); ?>

    If anyone has a clue, I sure could use the help.

    Thanks in advance,
    Sunny

  2. Sunny_Balanga
    Member
    Posted 3 years ago #

    Epiphany! After a little more "playing around", I discovered that I've been "ass"uming that accessing a post from a page that is set to display posts from one category using <?php query_posts('cat=catID'); ?> is the same as purely browsing a category. So it's NOT!

    When I browse the actual "category" (as opposed to the "query_posts page") it's all good!

    So the question now is - can it be made to work when browsing via "query_posts" in the way that I want - where all posts belong to both the "ARTICLES" and to a "SPECIFIC-TOPIC" category (of which there are many.)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic