0

How do I show a custom taxonomy in the same places as the theme that is set to display category.

I had the same problem with custom posts and solved using 'pre_get_posts' and $ query-> set ('post_type', array ('post', 'custom-post'))

Is there the same thing for custom taxonomy?

List of categories created with category

In Categories it is listing the categories created with category. I also want to list my custom_taxonomy_category categories

  • Are those sidebar widgets? Search the plugin repository for a custom taxonomy widget. – Milo Jul 13 '18 at 3:21
  • @milo Not only in the side bar but anywhere in the theme that requests categories. get_the_category_list () ... get_category () or anything like that. I want to override the normal category request so that only my custom taxonomy is listed. I want themes, plugins, treat my custom taxonomy as if it were the default category of wordpress – Bruno Andrade Jul 13 '18 at 3:48
0

If you want to list out the custom taxonomy you have to use get_terms function

For your requirement instead of creating new taxonomy you can modify the default category it self

function custom_change_cat_object() {
    global $wp_taxonomies;
    $labels = &$wp_taxonomies['category']->labels;
    $labels->name = 'Author';
    $labels->singular_name = 'Author';
    $labels->add_new = 'Add Author';
    $labels->add_new_item = 'Add Author';
    $labels->edit_item = 'Edit Author';
    $labels->new_item = 'Author';
    $labels->view_item = 'View Author';
    $labels->search_items = 'Search Authors';
    $labels->not_found = 'No Authors found';
    $labels->not_found_in_trash = 'No Authors found in Trash';
    $labels->all_items = 'All Authors';
    $labels->menu_name = 'Author';
    $labels->name_admin_bar = 'Author';
}
add_action( 'init', 'custom_change_cat_object' );
  • I'm using in a plugin not in a theme. I need the modification without making changes to the theme. – Bruno Andrade Jul 13 '18 at 2:47
  • @BrunoAndrade your Question is not much detailed..try to update your question with more details. are you creating the custom taxonomy using plugin? you can use the same code in the theme as well as plugin. You can create a simple widget and place it on sidebar widget area (not sure whether you have shown a sidebar screenshot in your question) – Latheesh V M Villa Jul 13 '18 at 2:57
  • it's simple I created a custom taxonomy and now I want everywhere in the site where the categories of the deafult taxonomy "category" are listed, also the categories of my custom taxonomy are listed. But I want to do this without changing the theme. I guess I have to use a filter but I do not know how. – Bruno Andrade Jul 13 '18 at 3:18
  • whether the categories are hard coded? i think it is shown with widgets. so what you can do is create a simple widget with in your plugin and place it below categories – Latheesh V M Villa Jul 13 '18 at 3:47
  • Not only in the side bar but anywhere in the theme that requests categories. get_the_category_list () ... get_category () or anything like that. I want to override the normal category request so that only my custom taxonomy is listed. I want themes, plugins, treat my custom taxonomy as if it were the default category of wordpress – Bruno Andrade Jul 13 '18 at 3:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.