简体   繁体   中英

How to achieve URL structure like “website-name/archive-page/category(or custom taxonomy)/custom-post-type” in WordPress?

So, I've been trying to make a page that looks like this:

If I go to 'website-name/tutorials' I get the list of my tutorial serie names (only names, not specific tutorials). I made a custom post type named "tutorial" and set it's URL to "tutorials", so this URL is plural.

However, no matter if I use custom taxonomies or categories, I can't get the URL structure I want, which is explained below:

If the user goes to 'website-name/tutorials' and clicks on one of the tutorial series, he gets to the URL of 'website-name/tutorials/tutorial-serie-name'. Then, he gets the list of all of the tutorials belonging to that custom taxonomy/category (because I tried using both custom taxonomies and categories) and gets to the URL 'website-name/tutorials/tutorial-serie-name/specific-tutorial-name'.

As I have stated, I tried using custom taxonomies and categories, but I simply can't make this URL structure, it is always 'website-name/tutorials/specific-tutorial-name' or, when I made category.php it was (note : category-name was the same as my tutorial serie name) : 'website-name/category/category-name'.

I just can't get that URL structure. I don't know how to achieve this, nor do I know do I have to use custom taxonomies in order to achieve it or I can stick to categories?

PS If you're wondering why I have to have this URL structure, it's because some of my tutorial series have tutorials with same name in them. For example, in my JavaScript series I have a tutorial named "Installing the program" and also in my C++ tutorial series I have that same tutorial name. So that's why I need this URL structure.

转到您的永久链接设置,并在自定义选项中使用%category%之类的东西,例如/%category%/%postname%应该可以使您的类别名称出现在永久链接结构中... http://codex.wordpress.org/ Using_Permalinks#Using_.25category.25_with_multiple_categories_on_a_post

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM