Genesis and WordPress Tutorials
by Sridhar Katakam 15 Comments Favorited: 6 times
To view the full content, please sign up for the membership.
Already a member? Log in below or here.
Find my tutorials helpful and wish to donate?
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.
if ( ! is_singular(‘post’) )
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.