• Hey Guys

    For my new site I built a category page (category.php) that means I can browse a top level category (/category/culture/) and a subcategory (/category/culture/reviews/) and they both utilise the same page (category.php)

    Now I have a Custom Post Type (recipe) with a custom taxonomy (recipetypes – Meal, Snack etc)/ Browsing /recipe/ displays archive-recipe.php, but get_term_link for any of the taxonomy terms returns a URL containing the taxonomy i.e. /recipetypes/meal/
    But I want this to use the same page template, it’ll essentially filter all recipes by the term selected, so I want the URL to be /recipe/meal/ and have this link to archive-recipe.php where I can extract the term for my WP_Query.

    It’s probably easy but this is my first theme and any advice would be appreciated ??

    Cheers

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter pr0fess0r

    (@pr0fess0r)

    I’ve made some progress.
    My archive page is archive-recipe.php
    My custom post type ‘recipe’ has been registered with
    'rewrite' => array( 'slug' => 'recipes'),
    So the URL is nicer – /recipes/
    And it correctly links to archive-recipe.php
    And get_term_link returns friendly URLs as well, i.e. Meals returns /recipes/meals/ BUT gives me a 404, would like this to also load archive-recipe.php

    Thread Starter pr0fess0r

    (@pr0fess0r)

    Debugging WordPress rewrites I’m getting

    recipes/([^/]+)(/[0-9]+)?/?$ => index.php?recipe=$matches[1]&page=$matches[2]

    index.php exists, but it’s empty as I use front-page.php for my homepage, categories.php for my article categories, single.php for my article posts… now I’m trying to build the page structure for recipes.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Can Custom Taxonomy archive and Term archive use the same file?’ is closed to new replies.