Hey there, a good while ago people on here helped me figure out how to display the name of one category for a post in its title text when in single view for that blog post. Its been very useful.
I was wondering however how would one do that with multiple categories associated with a post? I've found i'm using more and more categories for each post and would like all of them and not just the one with the lowest ID being included in the page title.
Here's the PHP thats worked so well for me so far:
$my_cat_name = $wpdb->get_var("SELECT cat_name FROM $wpdb->categories, $wpdb->post2cat WHERE cat_ID = category_id AND post_id = $post->ID");
Is there something i can do to this so I'll start showing all the categories instead of just the first one? Or do I need something completely different?