WordPress.org

Support

Support » Plugins and Hacks » Custom Post Type UI » [Resolved] By Category page

[Resolved] By Category page

Viewing 15 replies - 1 through 15 (of 16 total)
  • Plugin Author Michael Beckwith

    @tw2113

    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?

    pricklepantz

    @pricklepantz

    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

    Plugin Author Michael Beckwith

    @tw2113

    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”

    pricklepantz

    @pricklepantz

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

    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!

    Plugin Author Michael Beckwith

    @tw2113

    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.

    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!

    Plugin Author Michael Beckwith

    @tw2113

    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.

    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).

    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.

    Plugin Author Michael Beckwith

    @tw2113

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

    Plugin Author Michael Beckwith

    @tw2113

    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.

    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??

    Plugin Author Michael Beckwith

    @tw2113

    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.

    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.

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘[Resolved] By Category page’ is closed to new replies.
Skip to toolbar