Home > Wordpress Get > Wordpress Get Current Category Name

Wordpress Get Current Category Name


categories title conditional-tags conditional-content share|improve this question asked Dec 3 '12 at 17:36 ByteMyPixel 49112 1 Some function is echoing when it should be returning but without more code I Should it be "runs" or "run" in the following sentence? Why is nuclear waste dangerous? I am using single_cat_title(); instead of the_category(); because it displays the string value of the category which I then use to place a picture of the artist (whose category this is) this contact form

This site is not affiliated with the WordPress Foundation in any way. Is there a Pokémon + Move set that can solo the Elite Four without any restoring items in Pokemon X? DoublyLinkedList Implementation Java Why write 1,000,000,000 as 1000*1000*1000? The first line of code gets the full category data in get_category function by using one parameter - CATEGORY ID (because this is what get_query_var( 'cat' ) returns).

Wordpress Get Current Category Name

I went with this in my index.php file but i'd rather not hack core. Countries where lecture duration does not exceed one hour Call member function template parameter on shared_ptr If a Drow Druid uses Wild Shape to turn into a Spider, what is the 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 Or is it?

some other html …

Any ideas why this would be happening? Not the answer you're looking for? Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the Single_cat_title Slug the above category is one of many that is using this setup, which is why I can't hardcode it.

It totally solved my issue. –Hung The Feb 28 '15 at 7:33 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google are there drawbacks to this over Ram Mehar Deswal's answer? –dewd Jan 27 '14 at 15:38 This is actually the working solution, it will display the category of the You can then do $category = get_the_category(); $firstCategory = $category[0]->cat_name; share|improve this answer answered Nov 27 '10 at 4:45 Rfvgyhn 3,3251829 Thanks for the response. Old cartoon or anime featuring a girl protected by a Red Robot How secure is iterative password enhancement?

Personally, it seems that just making programming easier would be the better option, rather than making a comprehensive alternative to programming. Wordpress Get Category Description Who are the other people in this Shiva picture? is there a better solution? Join them; it only takes a minute: Sign up Wordpress category query not working up vote 0 down vote favorite I want to get the category from the current archive page

Wordpress Get Category Name By Id

Here is an example of what I'm talking about. more hot questions question feed lang-php about us tour help blog chat data legal privacy policy work here advertising info mobile contact us feedback Technology Life / Arts Culture / Recreation Wordpress Get Current Category Name Writing to multiple files with cat Serial Output returns wrong ASCII Would this be considered as plagiarism? Wordpress Get Category Name In Loop What is caching?

Not the answer you're looking for? weblink So all you need to do is swap: $thecat = single_cat_title( '', true ); to: $thecat = single_cat_title( '', false ); In your current code, you're just echoing the title, and What to display before the title.Required: NoDefault: (empty)(bool) $display Optional, default is true. WordPress Development Stack Exchange works best with JavaScript enabled current community chat Stack Overflow Meta Stack Overflow your communities Sign up or log in to customize your list. How To Display Category Name In Wordpress Page

Top ↑Related #Related Top ↑Uses #Uses wp-includes/general-template.php: single_term_title() Top ↑Used By #Used By wp-includes/general-template.php: get_the_archive_title() Top ↑User Contributed Notes #User Contributed Notes Skip to note content You must log in to return. (Note: WordPress functions that return rather than echo their output almost always start with get_.) –Chip Bennett Dec 3 '12 at 18:51 add a comment| 1 Answer 1 active oldest some other html …

And on the blog index page, the html result is correct like this: