Hi people,
I had something like that, and get it done with query_posts
, but it messed with my navigation throught “previous” and “next” entries.
I’m using WP 2.2.1, I don’t have any plugins activated, and my site leaves here: https://www.feiramoderna.net
I have 3 main sessions on the site, each one should display only the posts related to a certain category. So, I created a Page template for each session, and used a script to “filter” the posts, before the loop starts on each one of these Pages.
<?php query_posts(“cat=-25,-35”); ?>
It really filtered the content, showing only the posts that doesn’t belong to categories 25 and 35. But, for some reason, it made my navigation through “previous entries” and “next entries” not work at all. Every click on those links take me to a page that looks the same page, although the URL changes.
I’ve tried 2 ways:
<?php next_posts_link(‘? posts mais recentes’) ?> – <?php previous_posts_link(‘posts mais antigos ?’) ?>
and
<?php posts_nav_link(‘-‘,’? posts mais recentes’,’posts mais antigos ?’); ?>
Both of them shows the “previous” and “next” links, and creates URLs like:
feiramoderna.net/blog/page/3
feiramoderna.net/blog/page/2
But the content of each is basically the same as the main page feiramoderna.net/blog
I put the template here, in case anyone could help:
https://www.feiramoderna.net/blog_template.txt
This page template is not my index.php file. I use another page template for the Blog session.
I changed the template to the default Kubrick and it worked. Moved back to my, didn’t work again. So, I assumed that it was something wrong with the template I’ve designer.
Looking a lit bit further and trying some stuff I’ve tested removing the line <?php query_posts(“cat=-25,-35”); ?> and renaming the template file as index.php (also removing the first lines of the page, where I define the template name). The “previous / next entries” worked fine.
So, I assume there is a conflict between this query I’m doing to filter the posts of some categories, and the feature for creating the pages with “next” “previous” links.
I really need to have these 3 sessions, and to exclude some posts from the list on each page, according to the category they belong. But seems that the “next/previous” have some difficulties to understand me! ??
Anythoughts on how I could fix this?