Vill du skapa customize taxonomies i WordPress?
Som standard tillåter WordPress dig att organisera ditt content med kategorier och taggar. Men med customize taxonomies kan du ytterligare anpassa hur du sorterar ditt content.
I den här artikeln visar vi dig hur du enkelt skapar customize taxonomier i WordPress med eller utan att använda ett plugin.
Vad är en taxonomi i WordPress?
En taxonomi i WordPress är ett sätt att organisera grupper av inlägg och custom post types.
Som standard levereras WordPress med två taxonomier som anropas kategorier och taggar. Du kan använda dem för att organisera dina blogginlägg.
Men om du använder en custom post type kanske kategorier och taggar inte ser lämpliga ut för allt content.
You kan till exempel skapa en custom post type som heter ”Books” och sortera den med hjälp av en custom taxonomi som heter ”topics”.
Du kan add to ämnestermer som äventyr, romantik, skräck och andra ämnen du vill ha. Detta skulle allow you, och your läsare att enkelt sortera och filtrera böcker efter varje ämne.
Taxonomier kan också vara hierarkiska, vilket innebär att du kan ha huvudämnen, eller parent, ämnen som Fiction och Nonfiction. Sedan har du underämnen, eller children, under varje kategori.
Till exempel kan parent category Fiction ha Adventure, Romance och Horror som children.
Nu när du vet vad en custom taxonomi är, ska vi lära oss hur man skapar custom taxonomies i WordPress.
Att skapa customize taxonomies är kraftfullt, men det finns mycket att covera. För att hjälpa you att sätta upp detta på rätt sätt har vi skapat en enkel tabell med content under:
Skapa Custom Taxonomies i WordPress (Video Tutorial)
Om du föredrar skriftliga instruktioner, fortsätt då att Läsa.
Skapa customize taxonomier med ett plugin (det enkla sättet)
Det första du behöver göra är att installera och aktivera UI-pluginet Custom Post Type. För detaljer, se vår guide om hur du installerar ett plugin för WordPress.
I den här tutorialen har vi redan skapat en custom post type och antagit namnet ”Books”. Så se till att du har skapat en custom post type innan du börjar skapa dina taxonomier.
Gå sedan till CPT UI ” Add/Edit Taxonomies menu item i WordPress admin area för att skapa din första taxonomi.
På den här vyn måste du göra följande:
- Skapa din taxonomi slug (detta kommer att gå i din URL)
- Skapa pluraletiketten
- Skapa den singulära etiketten
- Automatisk ifyllning av etiketter
Your första steg är att skapa en slug för taxonomin. Denna slug används i URL:en och i WordPress sökningar.
Detta kan endast innehålla bokstäver och siffror och kommer automatiskt att konverteras till gemener.
Därefter fyller du i plural- och singularnamnen för din customize taxonomi.
Därifrån har du alternativet att klicka på länken ”Populate additional labels based on chosen labels. Om du gör detta kommer pluginet automatiskt att fylla i resten av etikettfälten åt dig.
Nu rullar du ner till section ”Additional Labels”. I detta area kan du ge en description av din post type.
Dessa etiketter används i din WordPress dashboard när du redigerar och hanterar content för viss custom taxonomi.
Härnäst har vi alternativet Settings. I det här area kan du ställa in olika attribut för varje taxonomi som du skapar. Varje alternativ har en description som ger detaljer om vad det gör.
I screenshot ovan ser du att vi valde att göra denna taxonomi hierarkisk. Detta innebär att våra taxonomi ”Ämnen” kan ha underämnen. I instance, a subject called Fiction can have sub-topics like Fantasy, Thriller, Mystery, and more.
Det finns många andra Settings längre ner på vyn i din WordPress dashboard, men du kan låta dem vara som de är i den här tutorialen.
You can now click on the ”Add Taxonomy” button at the bottom to save your custom taxonomi.
Efter det kan du gå vidare och edit den post type som är associerad med denna taxonomi i WordPress content type för att börja använda den.
Skapa Custom Taxonomies manuellt (med kod)
Den här metoden är obligatorisk för att du ska kunna add to kod på din website i WordPress. Om du ej har gjort det tidigare rekommenderar vi att du läser vår guide om hur du enkelt lägger till code snippets i WordPress.
Vi rekommenderar inte att du direkt editerar dina WordPress-filer eftersom minsta lilla misstag kan förstöra hela din site. Det är därför vi rekommenderar att alla använder WPCode, det enklaste och säkraste code snippet plugin available.
För att börja måste du installera och aktivera det gratis pluginet WPCode. För detaljerade instruktioner, se vår Step-by-Step guide om hur du installerar ett WordPress plugin.
1. Skapa en hierarkisk taxonomi
Låt oss börja med en hierarkisk taxonomi som gillar kategorier och kan ha parent- och child-termer.
När du har installerat och aktiverat WPCode kan du navigera till Code Snippets ” Add Snippet i din WordPress dashpanel.
Håll muspekaren över ”Add Your Custom Code (New Snippet)” och click ”Use Snippet”.
Därefter kommer du att tas till sidan ”Create Custom Snippet”. Namnge helt enkelt ditt nya code snippet och klistra in följande kod i textområdet.
//hook into the init action and call create_book_taxonomies when it fires
add_action( 'init', 'create_subjects_hierarchical_taxonomy', 0 );
//create a custom taxonomy name it subjects for your posts
function create_subjects_hierarchical_taxonomy() {
// Add new taxonomy, make it hierarchical like categories
//first do the translations part for GUI
$labels = array(
'name' => _x( 'Subjects', 'taxonomy general name' ),
'singular_name' => _x( 'Subject', 'taxonomy singular name' ),
'search_items' => __( 'Search Subjects' ),
'all_items' => __( 'All Subjects' ),
'parent_item' => __( 'Parent Subject' ),
'parent_item_colon' => __( 'Parent Subject:' ),
'edit_item' => __( 'Edit Subject' ),
'update_item' => __( 'Update Subject' ),
'add_new_item' => __( 'Add New Subject' ),
'new_item_name' => __( 'New Subject Name' ),
'menu_name' => __( 'Subjects' ),
);
// Now register the taxonomy
register_taxonomy('subjects',array('books'), array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'show_in_rest' => true,
'show_admin_column' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'subject' ),
));
}
Var noga med att ändra Code Type till ”PHP Snippet” och toggle omkopplaren till ”Active”.
Glöm inte att ersätta taxonominamnet och etiketterna i snippet med dina egna taxonomietiketter. You will also notice that this taxonomi is associated with the Books post type, you’ll need to change that to whatever post type you want to use it with.
Därefter rullar du ner och ser till att ”Auto Insert” och ”Run Everywhere” är valda i boxen Insertion.
När det är gjort kan du rulla tillbaka högst upp och klicka på knappen ”Update” för att få dina ändringar att gälla.
2. Skapa en icke-hierarkisk taxonomi
För att skapa en icke-hierarkisk customizer-taxonomi som gillar Tags, använder du WPCode och följer exakt samma steg som ovan, men du använder den här koden istället:
//hook into the init action and call create_topics_nonhierarchical_taxonomy when it fires
add_action( 'init', 'create_topics_nonhierarchical_taxonomy', 0 );
function create_topics_nonhierarchical_taxonomy() {
// Labels part for the GUI
$labels = array(
'name' => _x( 'Topics', 'taxonomy general name' ),
'singular_name' => _x( 'Topic', 'taxonomy singular name' ),
'search_items' => __( 'Search Topics' ),
'popular_items' => __( 'Popular Topics' ),
'all_items' => __( 'All Topics' ),
'parent_item' => null,
'parent_item_colon' => null,
'edit_item' => __( 'Edit Topic' ),
'update_item' => __( 'Update Topic' ),
'add_new_item' => __( 'Add New Topic' ),
'new_item_name' => __( 'New Topic Name' ),
'separate_items_with_commas' => __( 'Separate topics with commas' ),
'add_or_remove_items' => __( 'Add or remove topics' ),
'choose_from_most_used' => __( 'Choose from the most used topics' ),
'menu_name' => __( 'Topics' ),
);
// Now register the non-hierarchical taxonomy like tag
register_taxonomy('topics','books',array(
'hierarchical' => false,
'labels' => $labels,
'show_ui' => true,
'show_in_rest' => true,
'show_admin_column' => true,
'update_count_callback' => '_update_post_term_count',
'query_var' => true,
'rewrite' => array( 'slug' => 'topic' ),
));
}
Notice the difference between the 2 code snippets. Under register_taxonomy()
-funktionen sätts värdet för det hierarkiska
argumentet till true
för kategoriliknande taxonomier och false
för tagg/tagged-liknande taxonomier.
I arrayen labels för icke-hierarkiska taxonomier har vi också add to null
för argumenten parent_item
och parent_item_colon
, vilket innebär att inget kommer att visas i användargränssnittet när du skapar ett parent objekt eller en taxonomi som kan ha underämnen.
Återigen, var noga med att edit koden för att inkludera dina egna custom taxonomi etiketter.
Displaying Custom Taxonomies (visa custom taxonomier)
Nu när vi har skapat custom taxonomies och har add to några termer kommer your WordPress theme fortfarande inte att visa dem.
För att kunna displayed dem måste du add to lite kod i your WordPress theme eller barntema.
Denna kod måste addas till templates-filer där du vill visa termerna.
Du kan manuellt add detta snippet till dina theme-filer, till exempel single.php, content.php, archive.php eller index.php. För att ta reda på vilken fil du behöver editera, se vår guide till WordPress mall-hierarki för detaljer.
Det kan dock förstöra din site om det inte görs korrekt, så vi rekommenderar återigen att du använder det gratis tillägget WPCode.
Du måste add to följande kod där du vill visa termerna.
<?php the_terms( $post->ID, 'topics', 'Topics: ', ', ', ' ' ); ?>
Följ stegen ovan för att klistra in snippet i WPCode.
Men under Insertion vill du klicka på dropdown bredvid ”Location” och välja var du vill visa taxonomin, till exempel före posten, efter den eller till och med mellan stycken.
För denna tutorial kommer vi att select ”Insert After Post”.
Du kan se på bilden under hur det kommer att se ut på din site.
Lägga till taxonomier för Custom Posts
Nu när du vet hur man skapar customize taxonomies, låt oss använda dem med ett exempel.
Vi ska skapa en taxonomi och anropa den ”Facklitteratur”.
Eftersom vi har en custom post type som heter ’Books’, liknar det hur du skulle skapa ett vanligt blogginlägg.
I din WordPress dashboard, gå till Books ” Subjects för att add to en term eller ett ämne.
På den här vyn ser du 4 area:
- From Name
- Slug
- Förälder
- Beskrivning
I namnet skriver du ut den term som du vill add to. Du kan hoppa över slug-delen och ge en description för den här vissa termen (valfritt).
Slutligen klickar du på knappen ”Add New Subject” för att skapa din nya taxonomi.
Din nya term som har lagts till kommer nu att visas i den högra columnen.
Nu har du en new term som du kan använda i dina blogginlägg.
Du kan också lägga till termer direkt när du redigerar eller skriver content under viss post type.
Gå bara till Books ” Add New page för att skapa ett post. I postens editor hittar du alternativet att välja eller skapa nya termer från den högra colonnen.
När du har lagt till termer kan du gå vidare och publicera det innehållet.
Alla dina posts som arkiveras under den termen kommer att vara tillgängliga på din website på sin egen URL. For instance, posts filed under the Fiction subject would appear at the following URL:
https://example.com/subject/fiction/
Lägga till Custom Taxonomies i navigationsmenyn
Nu när du har skapat customize taxonomies kanske du vill visa dem i navigation menu på din website.
Gå till Customize ” Menus och välj de termer du vill add to under din custom taxonomi tabs som visas på vänster sida av vyn.
Glöm inte att klicka på knappen ”Save Menu” för att spara dina Settings.
You kan nu besöka din website för att se din menu in action.
Mer detaljer finns i vår Step-by-Step guide om hur du skapar en dropdown-meny i WordPress.
Ta taxonomier i WordPress vidare
Det finns massor av saker du kan göra med customize taxonomies. You kan till exempel visa dem i en widget i sidebar eller add to images icons för varje term.
Du kan också add to aktivera RSS-flöde för customize taxonomier i WordPress och aktivera användare att prenumerera på enskilda termer. På så sätt får dina läsare bara updates om det specifika content som är viktigt för dem.
Om du vill customize layouten på dina customiserade taxonomies pages, kan du kontrollera SeedProd. Det är en drag and drop WordPress page bu ilder och theme builder som allow you att skapa custom layouts utan någon kodning.
Vi hoppas att den här artikeln hjälpte dig att lära dig hur du skapar customize taxonomies i WordPress. Du kanske också vill se vår guide om hur man trackar website visitors, och hur man skapar ett custom WordPress theme utan att skriva någon kod.
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
Syed Balkhi
Hey WPBeginner readers,
Did you know you can win exciting prizes by commenting on WPBeginner?
Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
You can get more details about the contest from here.
Start sharing your thoughts below to stand a chance to win!
joe barrett
Don’t forget to add ’show_in_rest’ => true,
if you want to use your custom items in rest api to $args
WPBeginner Support
Thanks for sharing this for those wanting to add this functionality.
Administratör
Michael Morad-McCoy
I tried putting this in a site-specfic plug-in and get the following in a box at the top:
y() expects parameter 1 to be a valid callback, function ’create_topics_hierarchical_taxonomy’ not found or invalid function name in /home2/kaibabpr/public_html/wp-includes/class-wp-hook.php on line 286
Warning: Cannot modify header information – headers already sent by (output started at /home2/kaibabpr/public_html/wp-includes/class-wp-hook.php:286) in /home2/kaibabpr/public_html/wp-admin/includes/misc.php on line 1198
as this is the first time I tried this, I’m at a loss.
WPBeginner Support
You may want to ensure your site-specific plugin is a php file after you added the code as sometimes your operating system can try to edit the file type.
Administratör
Naji Boutros
Do you have a different plugin to recommend?
Ajeet singh
this is very helpful tutorial …..thnks a lot.
Suresh
Thanks for sharing this code. I used non-hierarchy code, and admin part is working fine. I have created a separate template as well like taxonomy-[taxoName]-.php But while trying to access the URL, giving HTTP error 500. I have tried multiple things, like new cache starts, permalink re-save, new .htaccess and memory increase. even then page is not working. kindly help
Rabby
WOW, Amazing and helpful details. I’ve created my custom taxonomy using manual rules. Thanks
Joseph Peter
Hi,
than you for this useful information, iam new to wordpress and i wanted to know the meaning thats i landed here, it was actually helpful.
Best Regards
Joseph Peter
Cindi Gay
I used the code for adding a tag to a custom post type. Luckily Topics is exactly the label I needed so all I needed to change was post to lesson (I am modifying the LifterLMS lesson post type).
Now I want to display the tags. I tried using the default WordPress Tag Cloud but it does not change to the newly added tag. It continues to show all my post tags even when I choose Topics
Is there a step I am missing? How do I display the new tag: Topics?
Ero
Taxonomies don’t behave exactly like default posts’ categories. They don’t appear in the URL (especially for nested taxonomies). Is there any way to set a custom taxonomy associated to a custom post type to behave like posts’ categories ?
Rangan Roy
I have used this code in my gallery custom post type for category support. It shows the name of the category but when i click on the category name it shows 404:error not found. Please help me to solve it. I want the category posts to show on my archive.php page.
Utshab Roy
I got this same problem that you are facing. The way I solved it is very easy. Go to your permalink settings and click the save button. Refresh the page. This simple step will save the issue.
Carol
This worked! Thank you so much.
Russell
Hi, I created custom meta box with new category. I can also show it to the post page. But when I click to the newly created category item it gives a 404 page. I wan it to work like tags, default category or author. So that If I click it shows all the post under that category.
Olivier
Hello,
I am new to WordPress and coding in general. This tutorial is very well explained, thank you.
However I don’t understand how to display the terms of my taxonomy on my pages.
Where do I have to go to ”Add this single line of code in your single.php file within the loop” ?
Thank you for your help
Best,
Olivier
Azamat
Thank you so much for this great tutorial!
I created custom taxanomy on my website dedicated to books and now I’m able to filter books by authors!
James Angel
The trouble with some plugins is that they may not be compatible with all themes. I have found that it pays to have a qualified developer do his/her part and test and troubleshoot any Web site alteration after adding a plugin or updating WordPress to a newer version to ensure everything works as it should.
paul
Man you are a legend,
i struggled 3 days to get this, which i found in many websites, but not as clear as this.
Thanks!
WPBeginner Support
Hey Paul, glad you found it helpful. Don’t forget to follow us on Facebook for more WordPress tips and tutorials.
Administratör
Rangan Roy
I have used this code in my gallery custom post type for category support. It shows the name of the category but when i click on the category name it shows 404.php page. Please help me to solve it. I want the category posts to show on my archive.php page.
Ayla
I’ve created a custom post type and a taxonomy to go with it, but when I create a custom post and add tags to it they don’t show up like normal tags do on normal posts. How do I get them to display at the bottom of the post like normal so people can click on them and find more like it?
Thank you!
-Ayla
WPBeginner Support
You will need to create a new template to display your custom post type and edit that template to show your custom taxonomy.
Administratör
Giulia
Hi everybody! First of all thank you for this article!
I’ve found that ”Simple Taxonomies” plugin is kind of out of date, since it hasn’t been updated since 2 years…. do you have any other plugin to suggest to create custom taxonomies?
thanks
Giulia
Mario
I’m not the author of this post, but I use ”Custom Post Type UI” to create custom taxonomies. With 300k installs, I’m pretty sure this plugin is as close as you can get to industry standard.
Hope this helps!
Ryan Hall
Amazing. thank you!
Ryan
How do you disassociate the posts with the ”regular” categories?
WPBeginner Support
Please see our guide on how to merge and bulk edit categories and tags in WordPress.
Administratör
Sunny
Hello,
The description is not prominent by default; however, some themes may show it. But still show on front.
How to hide taxonomy description from front ?
I want to add description on taxonomy but i don’t want they show on front .
Please tell me about what i can do.
Thank You
ajax
How do one automate the population of the taxonomy value with the value in a custom field.
Charles Hall
The article is OK, but the video is very poor. The sound quality is bad, she talks way too fast, obvious things are elaborated on but the explanation of what you’re doing and why is missing, as is the other content in the lower portion of the article.
Jennifer
I am working on a WordPress website. I created categories using a plugin called ”Categories Images”. One of the categories is named ”Videos” so there is one folder/category that is supposed to show videos but images. The problem is, because the plugin is designed to upload images only, the YouTube videos do not show up. How can I edit the PHP files (create a custom taxonomy, edit single.php, edit taxonomy-{taxonomy-slug}.php, etc.) so that the post can show and play YouTube videos??
Jamie Wallace
If you want more control over how things are pulled from the backend to the frontend look into using the Advanced Custom Fields plugin. This is a plugin for developers (so some code is involved) but its very powerful for things like what you ask
Muhammad
Hi I have followed the manual way of creating custom taxonomy and i just used Ads/Ad instead of Topics/Topic . But i don’t see any custom taxonomy in post editor though i checked the custom taxonomy form Screen Options.
though the custom taxonomy(Ads) is showing in admin submenu under Posts.
Muhammad
Here is my code snipped in functions.php file
_x( ’Ads’, ’taxonomy general name’ ),
’singular_name’ => _x( ’Ad’, ’taxonomy singular name’ ),
’search_items’ => __( ’Search Ads’ ),
’all_items’ => __( ’All Ads’ ),
’parent_item’ => __( ’Parent Ad’ ),
’parent_item_colon’ => __( ’Parent Ad:’ ),
’edit_item’ => __( ’Edit Ad’ ),
’update_item’ => __( ’Update Ad’ ),
’add_new_item’ => __( ’Add New Ad’ ),
’new_item_name’ => __( ’New Ad Name’ ),
’menu_name’ => __( ’Ads’ ),
);
// Now register the taxonomy
register_taxonomy(’ads’,array(’post’), array(
’hierarchical’ => true,
’labels’ => $labels,
’show_ui’ => true,
’show_admin_column’ => true,
’query_var’ => true,
’rewrite’ => array( ’slug’ => ’ad’ ),
));
}
?>
Robert Herold
How to show the number of posts on taxonomy-{taxonomy-slug}.php?
Robert Herold
How can I display my custom taxonomies list like the category list
WPBeginner Support
Please see our guide How to display custom taxonomy terms in WordPress sidebar widgets.
Administratör
Robert Herold
Wow! Thanx! Superb!!!!!! :))
Abdul Rauf Bhatti
Hy Dear WPBEGINNER SUPPORT,
I have learned many things in this tutorial next time will you please elaborate functions parameter which you have used some time i got in trouble or confused with parameters.
Thanks a lot Nice tutorial 5 rating
WPBeginner Support
Thanks for the feedback, we will try to improve our code explanation in the future.
Administratör
lee
Is there a way to get multiple custom taxonomy to use the same slug or same url? Please show us how if you or anyone knows.
pdepmcp
It may sound obvious, but…remember to refresh the permalink cache or you can waste some hours trying to figure out why archive pages don’t work…
Ilya
Thank you very much!!!
I wasted hours in debug mode, but cannot determine why my permalink redirects to 404 page! But after flushing ”permalink cache” all works fine.
Thank you again!
winson
Hello.
How can I get a different Posts Link? I mean I want to get 2 different links after I published a New Post.
E.G:
Category Name – > Facebook (theme template A)
Topic Name – > Twitter (theme template B)
Then I submit a post to these 2 Categories. I want get 1 link for ”Facebook” and 1 Link for ”Twitter”.
Best Regards
foolish coder
how to create single pages / templates for taxonomies?
I mean like single.php not like category.php
Alex
Try taxonomy.php ()
WPBeginner Staff
Yes, you can do that.
fatima
what if we want to create more than 2 taxonomies, categories style (hierarchy true)
Aalaap Ghag
I’m building a site which has multiple item thumbnails, each of which leads to a page with multiple images for that item (i.e. product). Are taxonomies the way to go or should I be looking at something else?
leona
Hi This is a great tutorial. But what if I want to display a custom taxonomies as posts in my menu? for instance I have a custom post type called ’poems’ and custom taxomies classic, modern, new wave. each poem post is assigned one of these taxonomies. In the menu I want to see a menu entitled poems with 3 subheadings (classic, modrn, new wave). Each will display only the poems tagged with one taxonomy. Is this possible?
angel1
This is great! How do I create ”related posts” for the custom taxonomy?
I’m assuming I need to put a conditional php code to display related posts for the new custom taxonomy to appear only when it’s a new taxonomy post and to hide when it is a basic category/tag post since they are both sharing the same content.php file.
Any suggestions would be greatly appreciated.
SteveMTNO
I used the code above to create the custom taxonomy – everything worked great. The field was added to all of my posts, and I populated it accordingly.
I’m using the ”Taxonomy Dropdown Widget” plugin – that works too.. sort of.
The dropdown is populated correctly, but when you click on one of the items to display those posts, I get a 404. However the plugin works for displaying tags.
Any ideas? I’ll be happy to post my code, just wasn’t sure if I paste it in here or somewhere and link to it here instead.
Let me know.. thanks!
SteveMTNO
Ruben
Go to Setting > Permalinks > Save Changes
(don’t need to make any changes, this just rewrites your .htaccess file so the link works)
This step should be included in the post?
David
Bad tutorial. You just expect people to copy/paste the code and don’t explain how it works.
WPBeginner Support
No, we don’t want people to just copy paste the code, we want them to study it and modify if they want.
Administratör
Cletus
Hi, can you recommend a different taxonomy plugin that works?
Even a premium version, the one you’ve posted hasn’t been updated in months and the author seems to have done one.
WPBeginner Support
The plugin works great, and the author has 19 other plugins. It also has great reviews and we have personally tested and used it. However, if you would still like to try some other plugin, then you can look at GenerateWP which will allow you to generate the code for your custom taxonomy. You can then paste this code in your theme’s functions.php file or a site-specific plugin.
Administratör
Dineshkumar
I am beginner using classifieds wordpress theme my taxonomy list is not working correctly
when i select country it shows correct bt when i select state it shows state list with city list when i select city i doesnot show below the parent how can i solve it without using plugin please help me
Joe
This is probably a newbie question, but I can’t find the answer anywhere. I want to display the hierarchical path of each page at the top of the page. This page for example has ”WPBEGINNER» BLOG» TUTORIALS» HOW TO CREATE CUSTOM TAXONOMI…” at the top and each item is a link. I lack the web vocabulary to know what this is called. If anyone can tell me what terms to search for to figure out how to do this that would be excellent.
WPBeginner Support
Joe these are called breadcrumbs. You can add breadcrumbs to your site using Yoast’s WordPress SEO Plugin. You can also search for breadcrumbs on WordPress plugin directory to find other plugins.
Administratör
Mark
I was getting 404 after manually setting up a custom taxonomy with your instructions and code. For anybody else who does, below is the solution I found on Codex.
”If your site uses custom permalinks, you will need to flush your permalink structure after making changes to your taxonomies, or else you may see a ”Page Not Found” error. Your permalink structure is automatically flushed when you visit Settings > Permalinks in your WordPress dashboard. ”
SteveMTNO
I was getting the same 404 issue after making the taxonomy change. Flushing the permalinks worked perfectly.. thanks!
Pepper
Hi,
thank you so much for your awesome tutorials!
Jordan
Hello, thank you for the great article.
Is there anyway to create a page for a custom taxonomy?
Right now my custom taxonomy is called ”issue” and I want to display all issue 1 posts on the home page. The problem is, the link looks like this example.com/issue/1 which is fine. Except that there is no way to make wordpress register this as the home page
Thanks
WPBeginner Support
You can replace your default index template with home.php inside home.php add this line just before the loop
$query = new WP_Query( array( ’issues’ => ’issue 1’ ) );
Administratör
Keisa
How can I display each taxonomy on separate pages?
For example//
PSDS (page)
—Vampire Diaries
——–Elena Gilberts
——–Stephen
——–Damon
——–Klaus
—Teen Wolf
——–Derek Hale
——–Scott McCall
——–Stiles Stilinski
——–Lydia Martin
How could I display each character on their own page using taxonomies?
I used ”psd_categories” for the taxonomy, then I added ”Teen Wolf” as a category.
I found a way to display links to the show’s page, but I have no idea on how to display all posts under each characters name…
I’m extremely new to this so please bare with me lol.
Can I send an email perhaps? >.<
WPBeginner Support
If you are using permalinks then you should automatically have separate pages for each term in a taxonomy.
For example if you create a taxonomy called characters, and mark some posts with term Stephen, then those posts will appear on
http://example.com/characters/stephen/
Administratör
JNorell
The archive-{taxonomy-slug}.php template did not work for me in WordPress 3.6 .. it needs to be taxonomy-{taxonomy-slug}.php instead (see http://codex.wordpress.org/Template_Hierarchy).
Thanks for the tutorial, it was helpful!
Editorial Staff
Fixed it Thanks
Administratör
Kiki
Is there a way to make the categories not hyperlinks? I just want them listed. I don’t want them to link anywhere.
Photoreview
Then consider creating custom fields instead of custom taxonomies.
Azis
thanks for the easy-to-understand tutorial
and could you help me to insert those custom taxonomies into the post class? like, for example… when we put a category named ’tutorial’ into the post, the category would normally get inserted in the post class as ’category-tutorial’, right? but it seems the example from this article doesn’t do that.
Once again, thanks for this great article.
P.S: I choose the manual way to create the custom taxonomies, since I prefer not to use additional plugins for my site if possible.
Robby Barnes
Hello and thanks for this information.
I am using the Responsive Child Theme on WP 3.5.1 on DreamHost.
I am building a WordPress site for a small print publication. I am trying to get my WordPress pages (not posts) to display the names of authors of articles that are on the pages. I installed the Simple Taxonomy plugin and created a custom taxonomy. I set it to work on pages and media, but not on posts. Using the widget for Simple Taxonomies I was able to have the author names show up on the right sidebar.
The custom taxonomy shows up on the Edit Page admin panel and seems to permit me to select authors to associate with a page… But, after updating the page the authors don’t appear on the HTML page.
I followed your suggestion and pasted some code into what I believe is the Loop (not sure if pages have the loop) and it didn’t change anything.
I would appreciate any suggestions for dealing with this. / Robby, Seattle, USA
Editorial Staff
The pages do have loop, and yes you would have to paste the code to make sure the taxonomy appears on the HTML page. Email us the page.php file or where you added the code. Use our contact form.
Administratör
Mattia
Hi, in the code example, I am missing how you link the ”topic” custom taxonomy to the ”books” custom post type… Should I replace ”post” with ”books”?
Editorial Staff
Yes that is correct.
Administratör
Arpit
How can i target categories of taxonomy?
Just like i want to execute a function when products of only Books > Fiction category is shown…