About Sridhar Katakam
I am an independent WordPress web consultant with 10 years of experience in WordPress theme installation, customization, administration, maintenance, support, documentation, troubleshooting and PSD/design to WP.
Genesis and WordPress Tutorials
Session expired
Please log in again. The login page will open in a new tab. After logging in you can close it and return to this page.
Wow, you’re a lifesaver! Thank you, Sridhar. Worked like a charm.
One other question: is there any way to get this same sort of function to appear in the Archive pages, as well? So that if I search on the site, for example, I know which category each article is filed under?
I tried adding is_post_type_archive instead of is_singular, but to no avail. I wonder if I’m missing something?
You want in all archive pages including search, right?
Yep! So that each post features the category name, just like on individual posts.
Try changing
if ( ! is_singular(‘post’) )
to
if ( ! ( is_singular(‘post’) || is_archive() ) )
and similarly in the other function, but without the exclamation.
That works for the archive pages, definitely! But not for searches, oddly. Or for the “Blog” page template (though that may be theme-specific, I’m not sure).
Change it to
if ( ! ( is_singular(‘post’) || is_archive() || is_search() || is_page_template(‘page_blog.php’) ) )
I added || is_search() and that worked well. The last piece is the Blog page… I’m trying to figure out what the code is for that.
See my reply above.
Yep, that’s what I figured for Search. But oddly, the Blog page still isn’t yielding the Category meta. Hmm – I wonder if it’s because I renamed the page?
Replace all/any code from this article with https://gist.github.com/8347446
Wow, yep. That works just right. You’ve done it again, Sridhar! I guess it took a tad more tinkering.
This just what I was looking for thank you! I want to add it above manual excerpts on a home page which shows latest blog posts – I tried adding ‘the_excerpt’ with no luck. Any suggestions?
Thank you Sridhar.