Your code is disjointed, but from the look of it you are passing an ID
as the category_name
value. The switch that would convert that to a name comes after the query.
Move this, or something like it,…
$link=$_GET['link'];
if ($link == '1'){
$category_name="accomodatins";
}
if ($link == '2'){
cat_switcher();
}
if ($link == '3'){
cat_switcher();
}
if ($link == '4'){
cat_switcher();
}
… up so that it is before the query and thus converts $link
which is a number to a name.
Also, don’t use query_posts
. Create a new WP_Query
object or use a filter on pre_get_posts