Filter by custom field and pagination
-
Hi all,
this is the goal:
filter some posts, added in a category, by a custom field and with the right pagination.The custom field is a value that I get through a form (dropdown menu in a sidebar with custom field values) and passed via php.
The custom query post code is in the archive.php file.This is the little code:
<?php $page = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("cat=12&meta_key=$cfname&meta_value=$cfvalue&paged=$page"); ?> cfname = the custom field name cfvalue = the custom field value
I get the filtered posts correctly but the pagination doesn’t work.
Here’s the problem:
the link “Next page” points to /category/page/2/ and it’s wrong. If I click I get the normal page 2 with ALL posts listed in that category but I need the page 2 with the posts filtered before.Any help or new idea pls? ??
Thanks,
ck
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Filter by custom field and pagination’ is closed to new replies.