• Hi all,

    I’ve searched high and low for this and can’t find a clear answer, but maybe I’m just bad at searching… ??
    Anyway, I apologize in advance if this has been covered already, and if it has thanks for pointing me in the right direction.

    So the thing is this:
    I have created a custom post type called “breves”, which uses the default/core categories and tags.
    I have no problem going to the domain.com/breves/ archive page, that uses the archive-breves.php and displays all “breves”, without distinction of tag or category, which is fine.

    I also know I can access domain.com/category/category-xx or domain.com/tag/tag-yy, and that outputs all types of post for category xx or tag yy, which is great and to be expected…

    But what I can’t figure out is how to see all “breves” from category xx or tag yy?
    I’ve tried domain.com/breves/category/xx and domain.com/category/xx/breves but none worked and from I understand of the way urls are constructed, it was to be expected…
    So what would the url be for those two archives? Does it even exist?

    Seeing as I’ll be adding a new category each week (I’m using them as “issues” for a magazine), I don’t want to have to add a page with a custom template (even a dynamic one) every week to show the “breves” of that issue/week/category (which is the only way I see now).

    What am I missing or misunderstanding?
    I have code at the ready if you need it, but I’ve checked it thoroughly (at least I think, and better than last time anyway) and don’t think it’s coming from there…
    Oh, and I’m using /%category%/%postname%/ as my permalink structure for post, I don’t know if that comes into play?

    I hope I was clear enough, otherwise please ask!
    And thanks a lot for your attention and answers…

    Marie

Viewing 1 replies (of 1 total)
  • Thread Starter pouipouidesign

    (@pouipouidesign)

    Ok, some follow up…

    Right after I’d posted, I found a new link I hadn’t come across in my hours of search, talking about pretty urls for those “normal category” pages for post types : https://sethstevenson.net/create-a-clean-url-for-your-custom-post-types-category-archives/

    It gave me both the “ugly” URLs (domain.com/post-type/?category_name=xx and domain.com/category/xx/?post_type=post-type) and a way to rewrite them in my functions.php using core wordpress functions.

    It’s not probably not perfect, but it did the trick so I thought I’d pass it along…

    It did make another issue appear though: those results don’t get paginated properly (or I should say I get 404 on the prev/next links), but it might be due to the rather specific/wierd setup I have (I filter the query (in functions.php) according to context to not show all post-types all the time, but it’s probably not perfect either), so I opted for changing the query in my post-type archive template to have a larger number of posts per page (it shouldn’t go any farther than 30-35 for each cat anyway).
    I would welcome an answer/pointer on that, though.

    Anyway, for future reference for anyone having the same question :
    URLs for custom post type archive by category (default, not custom taxonomy) :
    – domain.com/post-type/?category_name=xx
    – domain.com/category/xx/?post_type=post-type
    go to article linked at the beginning of this comment to learn how to have nicer urls.

    Of course, if anyone with better mastering of wordpress comes along, which is bound to occur, and has a better solution/answer to this, I’d be glad to hear it (and any answer/pointer about the pagination issue would be welcome too) of course!

    Thanks a lot again,
    Marie

Viewing 1 replies (of 1 total)
  • The topic ‘What's the URL for a CPT archive page of a given category (default, not custom)?’ is closed to new replies.