title: Get Wordpress Category from Single Post
body: <p>I'm finishing up a WP theme, and I'm on the single.php template. I'm having some issues because I need to access the parent category that a post is in in order to display certain images and XML content.</p>
  
  <p>Here is an example of what I'm talking about. The following is the end url of a single post:</p>
  
  <p>/andrew/leaf-art-2/</p>
  
  <p><code>/andrew/</code> is the category, and <code>leaf-art-2</code> is the single post. When I am on the single post, I am having trouble getting <code>single_cat_title();</code> to return the category that the current post is in. I am using <code>single_cat_title();</code> instead of <code>the_category();</code> because it displays the string value of the category which I then use to place a picture of the artist (whose category this is) on their posts. I don't have any use for the url, I just need the string with the category name.</p>
  
  <p>Any good ways of doing this? I have been searching the Wordpress Codex and lots of forums, and haven't found any answers yet.</p>
  
  <hr>
  
  <p>The following was my original post.</p>
  
  <p><del>I have set up a category called "artists" which when I run <code>single_cat_title("", false);</code> I can get the string value of the category and then use it to search for the appropriate artist image using XML.</del></p>
  
  <p><del>This works fine on the category.php template page.</del></p>
  
  <p><del>The problem is that when I'm actually inside of a single post that has the "artists" category, single_cat_title(); doesn't output any information to the page, thereby keeping me from accessing the XML data.</del></p>
  
  <p><del>I need to, while in the "artists" > "sample" post, be able to get from WP the category.</del></p>
  
  <p><del>P.S. the above category is one of many that is using this setup, which is why I can't hardcode it.</del></p>