WordPress custom post templates - wordpress

I am new in WordPress world. I created custom post successfully and I displayed it on page template page. Now I want to use taxonomy-{category}.php and single-{post}.php for displaying custom post but I am confused in taxonomy page and single page. How can I achieve this?
In taxonomy-{category}.php here category means our custom category name or others?
In single-{post}.php here post means custom post name or others?

See the Template_Hierarchy on the Wordpress Codex
taxonomy-{taxonomy}.php - If the taxonomy were sometax, WordPress
would look for taxonomy-sometax.php
single-{post_type}.php - If the post type were product, WordPress would look for single-product.php.
Example:
For post_type
When on an online store custom post type in the backend, the URL would be wp-admin/edit.php?post_type=store.
So the post_type in this case is store, which means I will name my file single-store.php
For taxonomy
When on the Categories page for the online store in the backend, the URL would be edit-tags.php?taxonomy=store_categories&post_type=store
So the taxonomy file would be taxonomy-store_categories.php

In taxonomy-{category}.php here category means our custom category name or others?
taxonomy-{category}.php here category means your custom category(taxonomy)
In single-{post}.php here post means custom post name or others?
single-{post}.php here post means custom post type name

Related

Wordpress custom taxonomy template doesn't display archive page

I register new custom taxonomy named "portfolio" using Custom Post Type UI plugin. Then create template taxonomy-portfolio.php and loop posts, expecting that when I type mysite.com/portfolio in browser, will get it. It works only when I get term of this taxonomy, I see this template, otherwise redirecting on 404. How can I use taxonomy template for archive?

How can i remove custom post type slug and add taxonomy

My question is about custom post rewrite url
On may page i have custom post type products
I have custom post type slug name - products and taxonomy - category.
I have urls like this:
domain.com/custom_post_type/product_name
but i need
domain.com/taxonomy/product_name
Is this acheivable?
To change the URL in wordpress go to settings -> permalinks
You can either choose a default permalink or create your own in this case.
https://codex.wordpress.org/Settings_Permalinks_Screen

How to customize wordpress category page

I am working on a wordpress website.I used genesis theme. I created custom post type and custom taxonomy to this site.And also created some categories to this post type.I want to customize the category page i.e.http://example.com/taxonomy-slug/category-name. Can anyone know please let me know what changes are necessary to customize the category page.
"taxonomy-{taxonomy}-{term}.php – If the taxonomy is sometax, and taxonomy’s term is someterm, WordPress will look for taxonomy-sometax-someterm.php. In the case of post formats, the taxonomy is ‘post_format’ and the terms are ‘post-format-{format}. i.e. taxonomy-post_format-post-format-link.php for the link post format.
taxonomy-{taxonomy}.php – If the taxonomy were sometax, WordPress would look for taxonomy-sometax.php."
source https://developer.wordpress.org/themes/basics/template-hierarchy/
so if you have for example custom taxonomy with slug "color" and have term with name "red" you just create taxonomy-color-red.php.

Create custom page for each taxonomy

I have a custom post type in which you can choose different taxonomies. This taxonomies are listed in the page of single custom post type. When clicking on one of this taxonomy, I would the user to be redirect to a specific taxonomy page that show different informations about that taxonomy.
How can I do that with word press?
I'm using bones framework.
There is no category.php in this framework.. So i found this file:
taxonomy-custom_cat.php
in which is written:
"This is the custom post type taxonomy template. If you edit the custom taxonomy name, you've got to change the name of this template to reflect that name change.
i.e. if your custom taxonomy is called
register_taxonomy( 'shoes',
then your single template should be taxonomy-shoes.php"
I did it but it doesn't work
PS: the taxonomy is called "agenti-biodeteriogeni"
Thank you
Make the copy of your category.php file and name it as your 'customposttype-category(taxonomy-name).php' this will display information of taxonomy like category.

Same string for custom page type and slug

I have a custom post type team and a page titled "Team" whose slug is also team.
Team page is assigned to page-team.php (template name "Team"). team custom post type uses single-team.php template file. When my browser points to /team it uses the index.php template instead of the page I wanted (the team page file).
How can I correct this?
From the Wordpress Codex: Post Types section URLs:
The new post type will also get its own special section of the site layout. In the above example, posts of this new "product" type can be displayed at http://example.com/product/%product_name% (where %product_name% is the URL-ized name of your product, i.e. http://example.com/product/foobrozinator.) You can see this link appear in the edit pages for your new type, just like other posts.
This means:
Your custom type team pages are all reachable under http://example.com/team/%slug%.
Since your slug is team the url is http://example.com/team/team.
Makes sense. The Codex page about custom post type is worth a good and thorough read.
Edit: If you aren't happy with /team/team, try the Custom post type permalink plugin.

Resources