• Resolved dpkonofa

    (@dpkonofa)


    I think I have this straight in my head but it’s not working the way I think it’s supposed to…

    I have setup a custom post type of ‘Materials’ and each material can fit into a specific type of group. I hesitate to call it a category because I don’t think it’s quite the same. In any case, I created ‘Materials’ as my post type and then ‘Material Type’ as the taxonomy and assigned the taxonomy to the material.

    The problem is… when I click on “View “, it goes to domain.tld/index.php/materials/oak, for example.

    I don’t see anyone else’s examples including index.php but, when I go to domain.tld/materials/oak, I get a 404. Where did I screw this up?

    Ideally, I’d like the end result to be http://domain.tld/materials/wood/oak where ‘Materials’ is the post type, ‘Wood’ is the taxonomy, and ‘Oak’ is the post title.

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

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Just out of initial curiosity, have you flushed your permalinks to take the new post type and taxonomy into account? Just visit the permalinks page and hit save without changing settings.

    Also, just to be certain things are registering correctly, do they work when you don’t have pretty permalinks enabled at all?

    Thread Starter dpkonofa

    (@dpkonofa)

    I did flush permalinks but my .htaccess file wasn’t writeable for some reason. That’s been adjusted and now I get http://domain.tld/materials/oak and http://domain.tld/material-type/wood/. Any way to combine the two to get http://domain.tld/materials/wood/oak or, to put it more generally, http://domain.tld/post-type/taxonomy/title?

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Excellent, steps forwards.

    For the last part, we’re getting into the rewrite API and how WordPress structures things, but I must admit we don’t have that level of customization built into CPTUI itself. It’s a complex topic really, and I don’t know it as well as I perhaps should. I’d end up googling around myself and doing trial/error to figure it out.

    Thread Starter dpkonofa

    (@dpkonofa)

    Ok… I don’t know why but I thought this was the entire point of custom post types. You go to Materials and see the categories, you click on the category and you see subcategories, you click on a subcategory and you see the items. I wonder if there’s an easy solution to this. I guess I’ll just end up coding my own pages.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Well, the issue is the url structure that is represented and you see in the browser address bar, not so much what links you’re clicking on in different pages. It’s definitely possible, but even when registering post types via your theme, you wouldn’t get those structures without some extra work.

    Thread Starter dpkonofa

    (@dpkonofa)

    Sorry to resurrect this thread… I need to bounce some questions off someone and you seem to know what you’re doing. πŸ˜›

    I have a custom taxonomy setup now called ‘organic’ and I want to create a page that lists out everything under that taxonomy. Under ‘organic’, I have child taxonomies called ‘wood’, ‘stone’, ‘marble’, etc. According to the WP docs/codex, I should be able to create these pages:

    taxonomy-organic.php – A listing page that lists out all the organic materials.
    taxonomy-organic-wood.php – A listing of all the materials in the wood taxonomy.
    taxonomy-organic-stone.php – A listing of all the materials in the stone taxonomy.

    Unfortunately, I’ve refreshed my permalinks (saved with no changes) and I’m getting a 404 when I go to http://domain.tld/organic/ or any of the sub-endpoints.

    Any ideas why that might not be working?

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    For as long as I’ve ever known, WordPress doesn’t have support for an “all terms in taxonomy” archive like they do posts in a post type. They DO support archives by term.

    http://domain.tld/organic/wood/ would show all posts for the “Wood” term, etc
    http://domain.tld/organic/ would not work.

    Someone would need to dig in deeper why the /organic/wood/ part is not returning anything. Best first guess I have is no posts assigned yet.

    Thread Starter dpkonofa

    (@dpkonofa)

    Hmm… Ok. This is what I was basing that off of: https://developer.wordpress.org/themes/template-files-section/taxonomy-templates/

    I thought that I could create a taxonomy-organic.php and customize that page to list the sub-categories under that.

    This whole thing seems like kind of a mess. I can’t believe it’s this cumbersome to get the structure I’m looking for. Thanks for the help. Your plugin is invaluable.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Unless I’m mistaken, taxonomy-{taxonomy}.php would be used for any term in $taxonomy, but doesn’t mean there’s an all-terms-in-taxonomy archive available out of box once a taxonomy is registered.

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Taxonomy/Post structure with index.php?’ is closed to new replies.