• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

snippet for functions.php to show category name

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › snippet for functions.php to show category name

This topic is: not resolved

Tagged: custom category, show category name

  • This topic has 9 replies, 2 voices, and was last updated 10 years, 9 months ago by babrees.
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • January 15, 2015 at 5:22 am #137519
    babrees
    Participant

    As the title says 🙂

    I want to add a snippet of code to the functions.php so that the category name and description will show on ALL categories, without my having to go in to edit and add it manually to each one.

    PLUS, I have a custom category type (Judges) that I want to do the same for

    Any ideas?

    Cheers
    Jill

    January 15, 2015 at 10:49 pm #137624
    Ren Ventura
    Member

    Hi, Jill. I just typed this up. Hopefully it's what you are looking for.

    http://www.engagewp.com/how-to-display-category-name-description-genesis/


    Web & Software Developer & Blogger | RenVentura.com | Follow Me on Twitter @CLE_Ren

    January 16, 2015 at 12:30 am #137633
    babrees
    Participant

    Hi Ren. Thanks!

    It does add the category but puts it in the sidebar and with no formatting. I can easily do the formatting by adding divs but how to ensure it goes in the content area, not the sidebar?

    Also, can you help with doing that for a custom category type, called "Judges" ?

    😀

    January 16, 2015 at 12:44 am #137634
    Ren Ventura
    Member

    I'm not sure why it would show up in the sidebar, especially without seeing your site. You can play around with the code and change the hook its using to something else (see the Visual Hook Guide).

    http://genesistutorials.com/visual-hook-guide/category/category-1/

    When you say custom category, is it a normal post category or is it something different? If it's a category under your Posts, the code will work for it like all the others. I guess I just need some additional explanation so I know exactly what you're trying to do.


    Web & Software Developer & Blogger | RenVentura.com | Follow Me on Twitter @CLE_Ren

    January 16, 2015 at 12:58 am #137637
    babrees
    Participant

    Hi Ren! Thanks again!

    I changed the before_content to before_entry - that works 🙂 At the moment, the site is in early stages of development and you won't see anything different to the magazine-pro theme at the front end.

    It is a custom taxonomy - category type. Not sure how else to describe it! In admin area, yes, it comes under posts in its own right and I add normal posts to it and it behaves like a category. However, your snippet on works for the default categories, NOT the custom one.

    January 16, 2015 at 1:11 am #137638
    babrees
    Participant

    OK, I've changed the is_category line to: if ( is_tax( 'judges' ) )

    That works but I can't get it working with is_category and the default categories don't work with is_tax!

    I'm stumbling a bit in the dark here.

    Would you be able to help me with adding something like the following?

    if ( is_tax( 'judges' ) )
    AND
    if (is_cat)

    January 16, 2015 at 1:17 am #137640
    Ren Ventura
    Member

    Thanks for the clarification. I updated the post/snippet to work with other taxonomies (tags and custom). Give it a shot.


    Web & Software Developer & Blogger | RenVentura.com | Follow Me on Twitter @CLE_Ren

    January 16, 2015 at 1:41 am #137641
    babrees
    Participant

    YES! BRILLIANT!

    Thank you so much Ren, I appreciate your help!

    I LOVE learning something new 😀

    Cheers
    Jill

    January 16, 2015 at 12:13 pm #137685
    Ren Ventura
    Member

    Glad to help!


    Web & Software Developer & Blogger | RenVentura.com | Follow Me on Twitter @CLE_Ren

    January 22, 2015 at 12:20 am #138242
    babrees
    Participant

    Just a small update for anybody else who might want this. You need to use before_loop, not before_content.

  • Author
    Posts
Viewing 10 posts - 1 through 10 (of 10 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble