WordPress.org

Ready to get started?Download WordPress

Forums

Custom Post Type UI
[resolved] By Category page (17 posts)

  1. pricklepantz
    Member
    Posted 5 months ago #

    I have googled and this seems to be problem for a lot of users.

    For my case, I created CPT Reviews and the configuration is as this image
    https://dl.dropboxusercontent.com/u/105017109/cpt-config.jpg

    Using custom query for post output the title with
    by Author on October 29, 2013 in Review

    where the "Review" links to http://mydomain.com/category/review
    However this will return error
    http://mydomain.com/category/reviews also error

    I tried non-coding way such as updating permalink to %category%/%postname% but it doesn't work

    Please kindly help, thank you so much in advanced.

    http://wordpress.org/plugins/custom-post-type-ui/

  2. Michael Beckwith
    Member
    Plugin Author

    Posted 5 months ago #

    Did you ever find a solution for this yet? From the looks of it, you're somehow getting categories and post types mixed up. What does http://mydomain.com/review/ show you?

  3. pricklepantz
    Member
    Posted 5 months ago #

    Hi, unfortunately, not yet.

    /review, It's a normal wp page with page template (from Canvas template) for archive. I modified it a bit with post_type args.

    Thanks

  4. Michael Beckwith
    Member
    Plugin Author

    Posted 5 months ago #

    So you're trying to show a category archive of a post type, within the context of a page?

    It also sounds like you have both a CPT and a category both named "review"

  5. pricklepantz
    Member
    Posted 5 months ago #

    Yes. You are right, on wp category I also have category named Review

  6. simco
    Member
    Posted 4 months ago #

    Hope you don't mind me jumping in here, but I think I have this same issue or, more appropriately, same question.

    I'm using your plugin to create a CPT called Bulbs. We're going to offer replacement light bulbs of various types. There are several of each type. Normally this would lead me to believe that I would create 'categories' representing the types and add a new 'bulb' and assign it to the proper 'category'. Which is what i've attempted to do. So, I have the following:

    CPT named Bulbs
    Need for categories such as
    A Lamps
    PAR Lamps
    T8 Lamps
    etc.

    And, the ability to add 'bulbs' that would display within those categories. In the CPT setup I chose the checkbox next to Categories which then displayed Categories in the Bulbs menu section. I then added my list of Categories only to find out those also extend to the regular Posts categories as well (in other words, the categories I created show in both the Bulbs / Categories and Posts / Categories areas. I thought they would be specific to just Bulbs).

    The goal is to have the bulb categories displayed in the main site menu (A Lamps | PAR Lamps | etc. | etc.)

    However, what's happening is when adding those categories to the menu and clicking on them, no results display. This is where i'm totally confused, how to connect the CPT to a categorical display.

    I've created a special post template that displays various custom fields. That part is taken care of. The part that is whacking me out is the association to a category to get a product list display.

    Any help here would be greatly appreciated!

  7. Michael Beckwith
    Member
    Plugin Author

    Posted 4 months ago #

    My initial hunch is that despite the co-association of the categories taxonomy, the queries using it aren't including your custom post type, just the 'post' post type. This is assuming the menu links lead to the category archive, where you don't have any 'post' posts with the category, and not querying for the CPT, resulting in no results.

    I hope that makes sense.

  8. simco
    Member
    Posted 4 months ago #

    Yes, makes perfect sense. And, in checking, that's what it does. It's querying for 'posts'. This brings up a new question, what would be my changes to that query? The name of the CPT? As in 'bulbs'? And, would it automatically filter based upon the category ID clicked on?

    And thank you for your quick response!

  9. Michael Beckwith
    Member
    Plugin Author

    Posted 4 months ago #

    I'd recommend the pre_get_posts hook and add your CPT to the query if on a category archive. Feel free to ask more questions if you need some help with that aspect.

  10. mrjive
    Member
    Posted 4 months ago #

    However, what's happening is when adding those categories to the menu and clicking on them, no results display. This is where i'm totally confused, how to connect the CPT to a categorical display.

    (If I understand it correctly) the only way I found to make category listing work is to use the plugin "Map Categories to Pages" and setting it to let Posts show in category listing (my custom post type has Post capabilities, I guess I should use the Pages option otherwise).

  11. simco
    Member
    Posted 4 months ago #

    My CPT was set for Posts and Category capabilities. That's why it's a bit confusing, I mistook that to mean that I could make categories specific to the CPT and separate from the regular blog post categories.

    Since I couldn't continue burning up time to figure this out I simply switched to Advanced Custom Fields plugin and made a special page template for bulbs to hold and display the custom field data.

    Here's what it looks like: http://www.nativeled.com/par-lamps/rsl-par-30c-energy-star-lamp/

    Originally I wanted to make the bulb 'types' into categories and the CPT of "bulbs" would be assigned to their respective category. Instead I just modified the menu so the top element was the type of bulb.

  12. Michael Beckwith
    Member
    Plugin Author

    Posted 4 months ago #

    Well, at least you found a solution somehow in the end. That's the important part.

  13. Michael Beckwith
    Member
    Plugin Author

    Posted 4 months ago #

    mrjive, posts, pages, and XYZ custom post type are all post types. WordPress doesn't assign categories to the Pages one by default because 95% of the time, it doesn't make sense to.

    You can assign the "category" taxonomy to post type that you want, but it's still 1 taxonomy and thus shared between any that it is registered to, it's not isolated per. If there is a way to create that separation without creating a brand new taxonomy, I'm not sure how, but it'd be an interesting read.

  14. simco
    Member
    Posted 4 months ago #

    This is an interesting conversation because i'm really interested in learning the structure of all the components that make up a CPT.

    Here's an example of what I envision how CPT's work. I've used many plugins on WordPress projects that enable the site to have ecommerce. A store, basically. Typically the store plugin creates a CPT, usually called "Products". Within that menu section of the admin it also contains "Product Categories" which, when created, are totally separate from the regular 'post' categories (or, 'blog' categories).

    This gives me the impression that one can create CPT's and CPT categories. But i'm probably confusing the CPT categories with taxonomies. It's fuzzy how they connect. But, again, in looking at ecommerce plugins like Woocommerce, they have the CPT to add a 'product' and assign it to a 'product category'. How can this be emulated in the real world??

  15. Michael Beckwith
    Member
    Plugin Author

    Posted 4 months ago #

    Going with that Woocommerce example, I checked a basic install with just their default ones, and they create taxonomies like "product_cat", "product_tag", "product_shipping_class". So those are all separate from the default "category", "post_tag" taxonomies that WP does by default. WooCommerce may just label it "Category" in the menu but it's still separate.

  16. mrjive
    Member
    Posted 4 months ago #

    You can assign the "category" taxonomy to post type that you want, but it's still 1 taxonomy and thus shared between any that it is registered to, it's not isolated per

    That's correct. That's why the plugin I mentioned is handy: you can choose to make posts and/or pages appear under the category I assign to pages, thus having the division between posts and pages I needed.

    As I said, that solved the problem I had just with CPT, that is: calling the category showed no posts / pages / other content.

  17. Michael Beckwith
    Member
    Plugin Author

    Posted 4 months ago #

    Well the issue with the category archives is because it doesn't query for all of the post types that have those category terms. Just the "post" post type. If the plugin you mention changes that, then yes, that's definitely a solution.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.