custom query to get posts
I want to create custom links like
mydomain.com/custom_page/cat=ABCtag=XYZ
So that when a user clicks on the link s/he can see all posts in the category 'ABC' having tag 'XYZ'
For this I've created a custom template with the following code
?php
/*
Template Name: MyCustomTemplate
*/
?
?php get_header(); ?
global $wp_query;
get_query_var( 'cat' );
get_query_var( 'tag' );
?php get_footer(); ?
I don't know how to query for the posts in the category 'ABC' with the tag 'XYZ'
I checked http://codex.wordpress.org/Function_Reference/query_posts#Passing_variables_to_query_posts
but the examples shown there use 'static' values. I need to query using dynamic values: which are passed via the URL.
Also, I'm using a plugin 'Advanced Custom Fields' and have added a field 'priority' with the defult value 'Z'. I intend to assign one alphabet to each post in the priority field, so that results on the page are served sorted according to "priority" : Posts with the priority 'A' on the top, followed by posts with priority 'B' and so on..
In Short:
I want to get category and tag parameters from links like:
mydomain.com/custom_page/cat=some_categorytag=some_tag
Then Fetch posts in the category 'some_category' AND having tag 'some_tag' AND sorted according to custom field : 'priority'
Topic wp-query query-posts query Wordpress
Category Web