Query_Posts to include tags or not
-
I am trying to view posts from a certain category and then if a tag is set then show the posts and if the tag is not then dont show the posts.. But what happens is if the tag is set it shows those posts and if the tag equals nothing then it shows nothing on the page:
address: /?page_id=19&tager=adams if(isset($_GET['tager'])){ $tager=$_GET['tager']; } if(isset($tager) || $tager!=""){ echo postListByCategoryID($firstColumnCategoryID,$paged,$tager); } else{ echo postListByCategoryID($firstColumnCategoryID); } function postListByCategoryID($categoryID = 0,$paged = 0,$tager="0") { $outputString = ''; //if(isset($tager) && $tager!=0){ if($tager===0 && $tager!="0"){ query_posts('offset='.$offset.'&cat=' . $categoryID . '&showposts=5&order=desc'); }else{ $taggy="&tag=$tager+$tager"; query_posts('offset='.$offset. '&cat=' . $categoryID . $taggy. '&showposts=5&order=desc'); }
Any help would be appreciated.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Query_Posts to include tags or not’ is closed to new replies.