Hello. I am trying to do (what I thought) was a pretty simple thing. I want to display a single line of CSS at the top of the page depending on the category. This is the first template I have made so I am walking a little bit blind.
Here is the code I tried
<?php $current_category = single_cat_title("", false);
if($current_category == "Category 1"){
echo "Yay! If I see this in the source code then it worked!";
}?>
That dose not give me anything. Apparently the Single_cat_title isn't outputting anything (or I am not sure what it is outputting. I assume it is supposed to be giving me the category name).
I know the code should work (assuming that I have all the right values) because if I change the single_cat_title to "Category 1" it works.
<?php $current_category = "Category 1";
if($current_category == "Category 1"){
echo "Yay! If I see this in the source code then it worked!";
}?>
If anyone could help answer why this isn't working, that would be great! Thanks in advance for any help :)