How to customize wordpress category page - wordpress

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.

Related

How do I make a tag taxonomy page?

I have woocommerce plugin. I created a custom tag taxonomy under products to pick the product ingredients. ( https://pasteboard.co/J2BlgqI.png ). To show them as buttons on the product page ( https://pasteboard.co/J2Bn7FD.jpg ).
Now I want the visitor when they click on the ingredient it shows them an ingredient page information. So, if they click on “Beeswax” it shows them Beeswax information like name, function and etc…
Each time I click on “Beeswax it directs me to a filter page https://pasteboard.co/J31hg2w.png .
How can I make a page for each ingredient?
Is it even doable this way? or is there another way to accomplish this?
please advice…
thanks
Yes you can have custom templates for your taxonomies. The template hierarchy explains everything.
Custom taxonomies use this template file path:
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.
taxonomy.php
archive.php
index.php
Since you haven't created a taxonomy-ingredients.php WordPress uses the next available option and falls back to the generic template.
You can even create a different template (page) for each of your Ingredient by using the first option above.

I have a personal taxonomy i.e car and i want to have a template to show car relevant post

I have created a custom post type named vehicles and there are different categories for that like trucks, cars, vans etc. I have created a taxonomy named vehicles-categories and now I want to show posts from taxonomy like cars on specific page which will show only posts from that certain category/taxonomy.
I have written WordPress custom loop but it does takes me to index.php page while I want different styles for that cars page.
Can anyone figure out what's am I doing wrong?
You have to create a custom template for your taxonomy to show posts from that specific taxonomy.
In your case if you want to show posts from term "car" then your template name will become taxonomy-vehicles-categories-car.php and WordPress will show posts on this page (you can style and get data according to your needs in this template).
Similarly, you can create taxonomy-vehicles-categories.php page to show posts from this taxonomy and can code this page to show posts as you want.
For further and in-depth understanding about how WordPress uses taxonomy template files visit the official codex page.

Rewrite wordpress custom taxonomy archive url

I have many custom post types and custom taxonomies such as "video" custom post type and "video_category", "product" and "product_category" and so on...
All the products are displayed at website.com/shop but if I get to an archive the permalink become website.com/product_category/"categoryname" and the single post has a link like website.com/product/"productname".
I have googled and found out about link rewriting but... don't really know where to start.
I'd like to have the links above become website.com/shop/"categoryname" and website.com/"categoryname"/"productname".
I could simply change the taxonomy name to "shop" for the first case but that would not be really clean, those are categories after all.

WordPress custom post templates

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

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.

Resources