开发者

Wordpress Archive by Year "query_posts()" Problem

I created an Archive list (also this is my archive.php codes) on my blog and i want to show posts by years.

But when i use query_posts() function for excluding some categories and limit posts then it's showing all posts not by year.

For example this page is showing all posts not only posts in 2009 years.

So if i summarize this issue; i want to show archive list by year (when i enter /2009/ per开发者_如何转开发malink)+exclude some categories and limit posts.

Thank you.


maybe when you use global variable, $query_string, it will help.

so you must use it like this

global $query_string;
query_posts($query_string . '&cat=-13,-4,-14,-171&posts_per_page=5&paged='. $paged);

as codex mention, here : query post,

Place a call to query_posts() in one of your Template files before The Loop begins. The wp_query object will generate a new SQL query using your parameters. When you do this, WordPress ignores the other parameters it receives via the URL (such as page number or category). If you want to preserve that information, you can use the $query_string global variable in the call to query_posts().
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜