• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Any Wordpress Hackers Here?

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
I should post this on the WP forums, but I figure that I'll get a better quality response here if there happens to be someone who knows the answer 🙂.

I've modified the page.php template for my site to display posts from a particular category, by inserting a call to query_posts(&cat=x). I saved this template as, let's say feature_page.php. I also modified index.php to exclude posts from this category on the home page, using a similar call. To be specific here are the two calls:

index.php -
query_posts($query_string . "&cat=-x&posts_per_page=10);

feature_page.php -
query_posts("cat=x&posts_per_page=10);

Both loops contain a call to page_nav() at the bottom.

In index.php the concatenation of the contents of $query_string was necessary to preserve navigation in the new query, because the requested page comes over as a rewritten url and turns into a querystring parameter.

I need the same thing in feature_page.php, but no matter what I do it doesn't work. I'm guessing that since the page name is part of the rewritten url it's breaking the nav somehow. I guess I can declare some variables and build my own navigation, but I'm hoping there's an easier answer.
 
I'm far from a wordpress hacker but the the code looks good except I'd encapsulate the strings with single quotes.

query_posts('cat=x&posts_per_page=10');
 
Looks like I missed a closing quote there. Most of the examples I see use single quotes, but the theme I am editing used double. Not sure if changing will make a difference but I'll give it a try. Thanks!
 
can you show us the site? I'm not sure what the issue exactly is. There are alternatives to query_posts()

If this is the function I'm thinking of, you can actually only use it once per request.
 
Originally posted by: NiKeFiDO
can you show us the site? I'm not sure what the issue exactly is. There are alternatives to query_posts()

If this is the function I'm thinking of, you can actually only use it once per request.

It's the first link in my sig, but you can't learn much by looking at it. The 'software' and 'articles' category pages don't handle nav. At the moment that's ok because there aren't enough entries to make it cumbersome yet. The issue is that query_posts handles nav correctly when its used in index.php, but appears not to when used in a page template.
 
Back
Top