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?
Related
I using custom post type
In the admin interface that displays the number of posts of custom post type by custom taxonomy on but when access (view), the custom taxonomy returns 404.
Custom post type oto
custom taxonomy oto-models
when I view the oto-404 models.
did you flushed the rewrite rules? otherwise the new taxonomys won't work.
just add flush_rewrite_rules(); and remove it after one request.
http://codex.wordpress.org/Function_Reference/flush_rewrite_rules
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
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.
I know how to create a custom template for a specific wordpress page. However, I would like to create a template for a specific custom post type. Is that possible and if it is possible, how can I do that?
To add a custom template for custom post types you can use single-{posttype}.php template. You can look at the template hierarchy diagram for more details.
For example if your post type is called books, your filename for the template should be single-books.php
If you have created a custom post type
If you have created a custom post type then you need to create a template who's name will be smiler to the custom post type for example if you have created a custom post type "product" then you will create a template with name product.php in your theme directory and to display a particulate post of your custom post type you will create another template with name single-product.phpthis template will be used to display your custom post and remember whatever custom post you create same name will be used to name your custom post type template and do not forget to add single in the beginning.
Template for a particulate post or a post of particulate category
And to display particular post in different template and to use different template to display post of particular category you can follow this link.
When creating a custom post type and fill it with some posts wordpress generates a page for that custom post type.
But I want to be able to add content to that page so I create a regular page and choose a template where I manually call the custom post type posts and loop them out. And now I can just add content in the wysiwyg editor. But this causes a conflict between these two pages, especially if the CPT has the same name as the page.
And now the question: Is there a way to always show the page where I have chosen the template for the CPT to always show? Even when someone try's to manually enter the url for the CPT generated page?
Here is what I understood from your question. You have custom post type. Then you created a page-template, that loops through your custom post types and output them. Now when you create a new page and assign it the page-template you have created you run into problems, if it has the same name as the custom post type.
Solution: I think what you need to do is change the custom-page slug from the admin menu. Then you would be able to directly reference it by the URL.