WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Category for Custom Post Type (5 posts)

  1. joshrodgers
    Member
    Posted 2 years ago #

    I am creating a restaurant website that has a "menu" custom post type. I am using categories to separate the different menu sections (appetizers, desserts, beverages, etc.).

    However, what I've noticed is categories are categories...so categories that are not specific to my custom post type also show up (like blog, slider, etc.). Is there any way to only show the specific categories that are relevant to my custom post type...or...is there any way to exclude or hide categories that aren't specific to my custom post type?

    Thanks,
    Josh

  2. keesiemeijer
    moderator
    Posted 2 years ago #

  3. joshrodgers
    Member
    Posted 2 years ago #

    kessiemeijer,

    The taxonomy solved my problem!!

    Ok, so all I had to do was add the following to my functions file: http://pastebin.com/H00nfgx2.

    "menu" is the name of my custom post type, if you'd like to add it to a normal post, all you have to do is change "menu" to "post".

    The title is "Categories", to change this to read something else look under label in the array and change the word "Categories" to "Your Title".

    Very simple! Works like a champ!!

    Thanks,
    Josh

  4. keesiemeijer
    moderator
    Posted 2 years ago #

    Well done! I'm glad you resolved it.

  5. joshrodgers
    Member
    Posted 2 years ago #

    Me too :)

Topic Closed

This topic has been closed to new replies.

About this Topic