The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End WordPress: displaying custom posts

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #166621

    So I have a custom post type called “Foods” with a custom taxonomy called “Categories” and custom fields like description, price, recipes, etc. I want to display all my post to a page where they are grouped by my custom taxonomy which is “Categories”. My problem is I don’t really know how or where to do it. I’ve read somewhere that I could use “archive.php” to list all and use “single.php” for each individual post. This page I’m trying to make is actually the “Menu” of the restaurant.

    I’m really new to WP and so I’d like to ask on where to start to achieve my goal.



    If you had a website called “”, and you wanted to access the archive page of your Foods with the category of “Fruit”, you would go to “”, where category would be the slug of your taxonomy. Accessing a single Food post page would use a URL like this: “”. This is only if you’re using pretty permalinks.

    WordPress custom menus allow you to add links to taxonomy archives.

    By default, your index.php file would build the structure of this archive, as well as the single Food post page. The template hierarchy shows you can override the index.php file for your taxonomy archive by creating a file called “archive.php”. You can be more specific by creating a file called “taxonomy-{SLUG}.php”, which for this case would be “taxonomy-category.php”. You would paste in the code from index.php and modify it however you want.

    The single Food post page template can be overridden by using a file called “single.php”, which would provide the code for any single post page of any post type. To only target your Food custom post type, you would create a file called “single-food.php”, and that would only build the page for single Food post pages.

    If you have custom fields in your custom post type, you would need to pull those into the page template using the “get_post_meta()” function.

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Back End’ is closed to new topics and replies.