Support » Plugins » [Plugin: Smarter Navigation] What about query_posts?

  • Hi Scribu. Another great plugin of your own. Your rocks man!.

    I’m having an issue with query_posts at the index page. I have 2 categories in my site: “portfolio” and “news / blog”. At the home page, I made a query_posts from portfolio category, so I display all post into it child categories. When I’m going to a single post from category archive, the plugins works like a charm. But when I’m going to a single post from home page, the next/previous links also links to posts into “news / blog” child categories. I tried placing the code as it follows:

    <?php previous_post_smart ('%link','prev', TRUE, '10 and 11'); ?>
    <?php next_post_smart ('%link','next', TRUE, '10 and 11'); ?>

    (10 and 11 are the cat ID for news / blog child categories).

    Do I doing anything wrong?.

    Thanks in advance and sorry for my english.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Currently, the plugin has to store the prev / next posts before any theme file is read. This means that it ignores your query_posts() command.

    So you’re not doing anything wrong – it’s just a limitation in the plugin.

    By the way: you can remove ’10 and 11′, since it’s also ignored.

    Ok. Thank you scribu!

    Hi Scribu. I was thinking about this issue. Is there a way to harcode the plugin to do something like “If you come from home, prev and next buttons have to navigate between portfolio category”?.


    Try this:

    Open main.php and find these lines:

    if ( $previous )
    	return previous_post_link($format, $title);
    	return next_post_link($format, $title);

    Replace them with this:

    if ( $previous )
    	return previous_post_link($format, $title, true);
    	return next_post_link($format, $title, true);

    Nothing changes.


    Works with this hardcode:

    if ( $previous )
        return previous_post_link($format, $title, FALSE, '10 and 11');
        return next_post_link($format, $title, FALSE, '10 and 11');

    My ‘main’ doesn’t have those lines. But here is my paginate.php which I assume is where I would want to make the changes:

    <div id=”pnav”>
    <div class=”alignleft”><?php previous_post_link(‘« %link’) ?></div>
    <div class=”alignright”><?php next_post_link(‘%link »’) ?></div>
    <?php } else if (is_page()) { ?>
    <div id=”pnav”>
    <?php link_pages(‘Page: ‘, ”, ‘number’); ?>
    <?php } else { ?>
    <div id=”pnav”>
    <div class=”alignleft”><?php previous_posts_link(‘Previous Post’); ?></div>
    <div class=”alignright”><?php next_posts_link(‘Next Post’); ?></div>
    <?php } ?>

    Where would I put the category I don’t want to be included in the “previous” and “next” links?
    (See how the navigation works when calling up a single page on

    Got it. Changed to:

    <div class=”alignleft”><?php previous_post_link(‘%link’, ‘%title’, FALSE, ’30’) ?></div>
    <div class=”alignright”><?php next_post_link(‘%link’, ‘%title’, FALSE, ’30’) ?></div>

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: Smarter Navigation] What about query_posts?’ is closed to new replies.