I tried to use Mike Smullin's "Sort Categories By Title" plugin to sort posts according to the value of the custom field "parag" which is a 4 digit number and modified the code to this:
add_action('pre_get_posts','sort_categories_by_title');
function sort_categories_by_title($x) {
if(in_category(4)) {
$x->query_vars['orderby'] = 'parag';
$x->query_vars['order'] = 'ASC';
}
}
I want to sort them only when displaying one category (#4 in this case) and then sorted by "parag" whatever value it has.
Help please!
ps. I tried is_category, in_category and a different custom value field but none of this seems to work. It also doesn't seem as if I have to call the function since it is included in the action call.